problems linking to boost libraries with old VS projects #23085
Replies: 6 comments
-
Hey @JonesOliver, It is possible that your existing projects have disabled the "inherit from project defaults" for additional library inputs and include directories. You can find this setting under project properties -> c++ -> additional include directories and tick the box for "inherit from project defaults". The linker setting is under linker -> additional dependencies and has a similar box. |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the quick response. I have checked those already, I didn't have them checked but checked them and it didn't solve it. I does build but won't link, so I can see reference the vcpkg/installed/x86-windows-static/include folder. In the linker settings there is nothing in the inherited values field and only '%(AdditionalLibraryDirectories)' in the Evaluated values field. One thing i did notice was that I do not have a /AppData/Local/vcpkg/vcpkg.user file. I don't think this matters as my test project builds. I can see the vcpkg.user.targets and the vcpkg\scripts\buildsystems\msbuild\vcpkg.targets. |
Beta Was this translation helpful? Give feedback.
-
Aha! We actually add the lib files directly to Linker -> Input -> Additional Dependencies, which is what makes the automatic linking work. We do also add the directories to AdditionalLibraryDirectories, but you would then need to manually specify the lib files. Could you check that you are inheriting values inside Project Properties -> Linker -> Input -> Additional Dependencies? |
Beta Was this translation helpful? Give feedback.
-
Hi, Yes the project does inherit the values.
Does you mean that I have to add an entry for each boost library that I need to link to, i.e boost_filesystem-vc140-mt-1_63.lib, as I do not have to in my test project? |
Beta Was this translation helpful? Give feedback.
-
You should not need to do that, but it would be a decent workaround if we can't diagnose the root cause. Could you send us the project file at [email protected]? One other possibility is we currently have issues when building VS2015 projects inside the VS2017 IDE. |
Beta Was this translation helpful? Give feedback.
-
Yes, I'd rather not have to specify the libraries explicitly. I have included 2 project files, one is for an internal library and the other is our application that depends on the internal library, boost::filesystem is required by both. I have stripped both project files down to only include the release build configuration for both projects and have remove all of the files included in the projects as you should need these. Hopefully that is enough to go on. I've also included the build log for the build that shows the linker errors. If you require any other information then please let me know, thanks again for your time, appreciated. |
Beta Was this translation helpful? Give feedback.
-
I've managed to link to boost with a sample test project using both the x86-windows and x86-windows-static triplets, but cannot seem to link the boost libraries to an existing project. Has anyone tried to do this and been successful? Anyone also had problem using vcpkg, boost and old VS projects?
I'm simply using the boost::filesystem and can successfully link to a set of static boost libraries that I've built and maintain myself.
For reference and if anyone finds this useful, to link to the static libs I copied in the following in my vs project in my test application file under <PropertyGroup Label="Globals"> :
<VcpkgTriplet>x86-windows-static</VcpkgTriplet>
<VcpkgEnabled>true</VcpkgEnabled>
but also had to change the code generation setting "Runtime Library" from Multi-threaded Debug DLL /MDd to Multii-threaded Debug /MTd
Beta Was this translation helpful? Give feedback.
All reactions