how to use boost libs in project (VS2015) - c++

I have Visual Studio 2015 and I'm trying to build the sample boost 1.62 link program on the 'Boost Getting Started' page. I followed the build steps in order to compile the various binaries, like regex. These are the steps:
c:\boost> bootstrap
c:\boost> .\b2
I got multiple errors because 'pyconfig.h' was missing, but I don't need this so I thought it was ok.
I set the 'Additional Libraries Directory' in my test project to c:\boost\libs, but at link time, get:
error: cannot open file libboost_regex-vc140-mt-gd-1_62.lib
I looked under .\libs and there were no lib files under there. I did see a new bin.v2 directory under boost\, which, under a very complicate tree has the lib file.
I set the 'Additional Libraries Directories' in my project to c:\boost\bin.v2, but same error.
Can anyone tell me what I need to do to be able to link successfully? Do I need to resolve that pyconfig.h error to get the libs deployed to the right location?

I found the problem. It appears VC++ projects should add an include path to .\boost\stage\lib, instead of what the boost webpage says. I don't know if this is true intention, but it appears to work.

Related

code execution cannot proceed because cpprest_2_10.dll was not found

My aim is to use the Rest API in Visual Studio.
I downloaded the C++ tool vcpkg from https://github.com/Microsoft/vcpkg and followed the instructions on https://github.com/Microsoft/cpprestsdk to install cpprestsdk. That worked fine.
Then, in Visual Studio in the properties of the solution explorer, I included the following paths from the vcpkg folder into "VCC++ Directories->Include directories":
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include\cpprest
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include\pplx
Then I run my code and the following errors occur:
LNK2001 unresolved external symbols (32 errors like this)
I googled it and was told to include the respective ".lib"-files into "Properties->Linker->Input->Additional Dependencies" and to include the paths of the corresponding ".dll"-files into "Properties->Linker->General->Additional Library Directories", what I did.
Now, running the code again, just the following error occurs:
code execution cannot proceed because cpprest_2_10.dll was not found. Reinstalling the program may fix the problem,
although the "cpprest_2_10.dll" is in the path, which I included previously.
I have no idea what the problem is. Thank you in advance for your time.
Try to put the missing dll file right to the directory of your compiled exe.
Or check this answer to set a path so your binary can find the dll file:
How do I set the path to a DLL file in Visual Studio?

Visual Studio 2013 cannot open 'glfw3.lib'

I'm having a few issues getting GLFW3 set up. I've downloaded the 64-bit binaries from the official site, added glfw3.dll, glfw3.lib and glfw3.h to their respective places, specified the proper include, and added the appropriate linker input to my project. However, when I test the library with glfwInit(), VS spits this out:
error LNK1104: cannot open file 'glfw3.lib' Path/To/Project
My guess was that VS didn't know what directory the library was in, but seeing as it's in the IDE's own lib folder, I don't think this is it. Does anyone have any suggestions? Sorry if this has already been solved, I got in as deep as to read the steps of compilation before I gave up searching.
Edit: I also changed the solution platform to x64, since I am using the 64-bit GLFW binaries.
Following Andon M. Coleman's advice, I moved the headers and library folders to a new directory outside of Visual Studio's built-in ones (D:\opengl-wrappers\lib & D:\opengl-wrappers\include, for example). After including those libraries in the project settings (C/C++->General-> Additional Include Directories and Linker->General->Additional Library Directories), everything compiled beautifully.

Ogre3d cant link boost libraries in visual studio 2010

I recently tried to set up an ogre 3d v.19 project following the tutorials on their webpage.
After setting up the project i try to build it and I get the following error:
LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-gd-1_55.lib'
I made sure i'm using the right ogre SDk(vc10). I also checked if the file above was on its place - and it was! It's in the folder it's supposed to but i still get the error.
Please help.
You should gently check, that all boost libs (basically located at "OgreSDK_vc10_v1-9-0\boost\lib\"), e.g., for debug configuration:
libboost_thread-vc100-mt-gd-1_55.lib
libboost_system-vc100-mt-gd-1_55.lib
libboost_date_time-vc100-mt-gd-1_55.lib
libboost_chrono-vc100-mt-gd-1_55.lib
are declared in your project config (Project->Settings->Linker->Input->Additional dependencies). Besides, you should provide correct path, where VS2010 will seek this libs, by specifying Project->Settings->Linker->General->Additional Library Directories. After all these steps, linker have all the information to detect needed libraries and to process them.
I think you didn't link the libraries to Boost, check for these:
Configuration Properties - Linker - General - Additional Library Directories
$(OGRE_HOME)\boost\lib
$(OGRE_HOME)\lib\$(Configuration)

Visual Studio 2010 Assimp library won't link

I seem to have a perpetual problem of never being able to get any library to link with Visual Studio. Ever. I eventually get tired of trying and just include the header and source files manually.
My latest endeavour is trying to set up Assimp. I went and downloaded the latest version and followed the installation guide for Visual Studio 2010. http://assimp.sourceforge.net/lib_html/install.html
The result:
LINK : fatal error LNK1104: cannot open file 'assimp--3.0.1270-sdk/lib/assimp_release-dll_x64/assimp.lib'
I set the include directories:
assimp--3.0.1270-sdk/include
I set the library directories:
assimp--3.0.1270-sdk/lib/assimp_release-dll_x64
I set the additional dependencies (the guide includes the directories, but shouldn't I just be able to just put assimp.lib since I included the library directory above?):
assimp--3.0.1270-sdk/lib/assimp_release-dll_x64/assimp.lib
What am I doing wrong?
Also, considering this isn't my first time having these difficulties, are there any good tutorials to help me understand this process a little better? I've tried searching for it but most are for previous versions of VS...
My guess is you should provide explicitly relative or absolute paths for the library directory.
You're right about the dependency name, assimp.lib is the correct name and the guide is a bit ambiguous here.
Apart from that, you're doing everything right. Provided the lib file exists, it should link.
(assimp co-founder writing here)

fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-gd-1_43.lib'

Made a new project, added main.cpp and wrote the code at this URL:
http://www.boost.org/doc/libs/1_43_0/doc/html/boost_asio/example/echo/async_tcp_echo_server.cpp
Also, added the appropriate include path.
What's next?!?!! It seems like a darn mystery to build a boost code!
Been digging on it for more than 10 hours.
Can anyone give a straightforward answer on how to build the boost library from the code under windows, VC9?
You need to use bjam. It is responsible for creating the libraries that your application will use. Once you use bjam, you are going to need to instruct your project to include the lib file. You do this by going into the project's properties -> Configuration Properties -> Linker -> General. Add the directory which created the lib file to Additional Library Directories. You should be capable of correctly linking after that.
I believe that this link describes the steps better than I could attempt in a post
#bogertron: I want to hug you! (:
So, at last, with a real head ache, I've managed to do so.
The exact steps I took, so others will be saved from the head ache:
Went to http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html#or-build-binaries-from-source .
Followed the "5.3.1 Get bjam" clause. Downloaded the "pre-built bjam executable for your platform" at this URL: http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941 .
Extracted the ZIP file (my platform is Windows).
Ran "build.bat". It produced the file "bin.ntx86/bjam.exe".
Copied this file to my PATH ("...../boost_1_43_0/").
From a command line, executed "bjam.exe" and waited for about 4-5 minutes.
Then got this message at the console: "The Boost C++ Libraries were successfully built!"
That's it, it even tells you where the include & lib files are.
Not all Boost libraries are header only, Boost.System is one of them. The documentation for Boost.Asio tells you that it depends on Boost.System.
With Visual Studio, the Boost libraries use auto-linking, which means you don't have to explicitly link to the libraries you need. You however need to have the necessary libraries in the library search path, either globally or per-project.
If you don't want to build the Boost libraries yourself, you can use the installers provided by boostpro (only up to Boost 1.42 though at the moment). If you want to build them yourself instead, the documentation covers that well.
I had the same error and i followed the SourceForge. The link will take you to a folder of zipped lib and dll files for version of boost.You can download and unzip related library and when copied it to the related location everything gonna be alright ;)
In Visual Studio, right-click on your project, then go to properties and select:
Properties -> Configuration Properties -> Linker
There you add the full path of your library in the tab named "Additional Library Directories".
From the "Boost Getting Started Directions":
"5.2 Or, Simplified Build From Source
If you wish to build from source with Visual C++, you can use a simple build procedure described in this section. Open the command prompt and change your current directory to the Boost root directory. Then, type the following commands:
bootstrap
.\b2"
On Windows, I opened the Visual Studio Command Line from the start menu. First I types "bootstrap" and then I typed ".\b2".
Now with boost_1.50 the Boost.build is included in the zip file: check tools\build\v2\ or better read: ...boost_1_50_0/more/getting_started/windows.html