Linking against Boost python 3.6. can't find boost_python instead of boost_python3

后端 未结 3 1852
一生所求
一生所求 2020-12-21 18:27

I have problems linking against boost python.

I am using Visual Studio 2017 and compiled the boost 1_64 package with the following command line:

b2          


        
相关标签:
3条回答
  • 2020-12-21 18:42

    Sorry for coming in late here, just went through the same nonsense myself. Turns out that boost doesn't handle two installs very well (or even a py3.x by itself)

    You can definitely solve this by going into <boost/python/detail/config.hpp> and making a quick change. To allow for boost to work with both python 2.x (2.7, presumably) and 3.x, I'd suggest changing:

    #define BOOST_LIB_NAME boost_python

    to

    #if PY_MAJOR_VERSION >=3
      #define BOOST_LIB_NAME boost_python3
    #else
      #define BOOST_LIB_NAME boost_python
    #endif
    
    0 讨论(0)
  • 2020-12-21 18:45

    You provide

    boost_python3-vc141-mt-gd-1_64.dll
    boost_python3-vc141-mt-gd-1_64.lib
    

    but the error reports missing

    boost_python-vc141-mt-gd-1_64.lib
    

    (spot the difference!)

    So obviously, your IDE (VS) attempts to build a python, not a python3 extension. I don't know VS, but there must be away to change that somewhere somehow.

    0 讨论(0)
  • 2020-12-21 18:57

    I just want to heads up here as this happened to me. Here is the link. It may have been that you included the 2.7 python headers instead of the 3.6. And yea, nothing about it is obvious, it really put me to work.

    0 讨论(0)
提交回复
热议问题