0

I basically did the same as the person here:

Building/including Boost.Python in VS2013

However, I used an empty cpp file with only the main function and the inclusion of <boost/python.hpp>

#include <boost/python.hpp>


int main() {
    return 0;
}

Now I get the strange linker error (in Visual Studio):

1>LINK : fatal error LNK1104: cannot open file 'boost_python-vc140-mt-gd-1_60.lib'

Which is strange, because I have the lib file I think, however, it is called:

libboost_python3-vc140-mt-gd-1_60.lib
Community
  • 1
  • 1
NOhs
  • 2,780
  • 3
  • 25
  • 59
  • 3
    Your program is trying to link dynamically to Boost.Python. Try adding `#define BOOST_PYTHON_STATIC_LIB` in your cpp file, before any `#include`. `boost_python-vc140-mt-gd-1_60.lib` is the import library that accompanies `boost_python-vc140-mt-gd-1_60.dll`, while `libboost_python3-vc140-mt-gd-1_60.lib` is the static library. You probably want to build the DLL for Boost.Python. Static linking has several pitfalls, like each of your extensions having its own copy of Boost.Python's type registry. You can find more information about that by Googling. – Praetorian Jan 19 '16 at 18:12
  • ^ You, sir, just saved my life. – Hame Mar 29 '16 at 17:13

1 Answers1

0

You need to configure your Visual C++ project setting. The following case operates well.

  • [debug platform mode] x64
  • [include directory] (..\;;);C:\boost\boost_1_60_0\;C:\Python35\include\; # add your actual boost and python directory path
  • [library directory] (..\;;);C:\Python35\libs\;C:\boost\boost_1_60_0\stage\lib; # add your actual boost and python library path