I can write whole path to the boost_python3-vc120-mt-1_64.lib including file name, not just folder name in section "Additional Library Directories") Do the linker options allow specifying lib-file directly? (i.e.Is it possible to influence the logic used by VS to look for Boost.Python library? (Of course lib-files renaming is also an option, but I do not like this for some reason).I suppose, VS2013 knows boost library file name convention, but probably does not know the difference about Python 2 and Python 3. I noticed that changing the build type (Solution Configuration) from Debug to Release leads to change the error message in part of library file name (there is no -gd- now):Įrror 1 error LNK1104: cannot open file 'boost_python-vc120-mt-1_64.lib' The only useful information is that library file names *boost_python-* corresponds to Python 2 and *boost_python3-* to Python 3. Similar questions at stackoverflow and in google groups are discussed but without valuable tips. It is noteworthy that the difference in filenames I had and VS2013 looking for is just digit 3 after word python. to the next error:Įrror 1 error LNK1104: cannot open file 'boost_python-vc120-mt-gd-1_64.lib' So in project properties for Linker settings "Additional Library Directories" I added corresponding location (ends with PythonPython36libs). In project properties for C/C++ settings I added "Additional Include Directories" to locations of Boost and Python (ends with Python36include).ĭuring the first attempt to build the project an error appears:Įrror 1 error LNK1104: cannot open file 'python36.lib'
Then I created project (type: Win32 / DLL) in Visual Studio with the following code taken here: char const* greet() In order to try examples with Boost.Python I downloaded boost 1.64.0 and build libraries by b2 with options -with-python -toolset=msvc -build-type=complete.
Use the comment section if there are any questions.I had Microsoft Visual Studio Community 2013 (Version 1.00 Update 4) and Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017) on my PC with Windows 10 Pro. Open properties for the project, and add include and library paths to your Boost installation. And all projects can have many configurations and architectures. For solutions having many projects, all projects must reference the same installation of Boost. While this is quick and dirty, and gets the job done, it will make upgrading Boost a pain later. The other “inferior” way is to add the Boost include and library paths to the project files itself. Verify the property sheet is added for all configurations. We have property sheets for several versions of the C++ Boost library at our Studiofreya Github page (.props files).Īdd existing property sheet (the one you saved in the previous step). The build script can be edited so this happens automatically.
If you are using x86 as the platform for 32-bit code, then the libraries must be in stage/x86. In the recent versions of Visual Studio, the default platform for 32-bit code is x86, not Win32. By using a generic name for the property sheet, it’s easier to edit the property sheet itself for the next version of boost.Īnother thing to remember. Don’t save the version of boost in the filename. Save the property sheet in a file called boost_current.props.
$(PropSheetPath)boost_1_64_0\ %(AdditionalIncludeDirectories) $(::GetFullPath('$(MSBuildThisFileDirectory)')) Here is a property sheet for Boost version 1.64 for VS17: Property sheetsĪs for any of the previous versions of Boost (1.63 and down) the best way of using Boost with Visual Studio is to use property sheets. Remember, only Boost 1.64 and up works with Visual Studio 2017.
After installing one of the versions of the C++ Boost library you need to know how to use it in VS2017.