Missing boosts filesystem lib after build - c++

I have the latest version of boost (1.58). After building it via command line on windows:
bootstrap
.\b2
I add boost dir to path and boost/stage/lib to lib path.
I add #include to my code and when I compile I get an error saying:
Error 1 error LNK1104: cannot open file 'libboost_filesystem-vc120-mt-sgd-1_58.lib' E:\SourceControl\zombiegame\ZombieGame\Projects\Windows\LINK ZombieGame
I'm not including any lib myself so guessing boost is doing this via the code, but this file doesn't exist in the stage/lib path.
The closest I have is libboost_filesystem-vc120-mt-gd-1_58.lib but you can see it's -gd- not -sgd- like it's asking for. What am I missing here?

You are probably using a configuration that is not provided by boost. Boost build its libraries with different settings for Debug/Release and (here I think is the point) for Runtime library (static lib/dynamic dll/single threaded/multithread). From the names I would guess you have a static or single threaded config. Try to change that one and you should find one of those provided by boost build.

Related

Linking boost library in node native module, object file requiring alternative library version

I recently had the need to pull in the Boost Graph Library for one of the native node modules that I work on, along with boost serialization. There is a separate VS project that I do all of my development and testing for this module. The project compiles, links, and works as expected when run from the VS project.
I am having issues when I try to link the static serialization library with my module when building with node-gyp. I have included the full path to the serialization library in the libraries section of the binding.gyp file. In the object file produced from the node-gyp compiled file, the following line is causing a linker failure:
/FAILIFMISMATCH:"_CRT_STDIO_ISO_WIDE_SPECIFIERS=0"^#^Dlibboost_serialization-vc140-mt-s-x64-1_67.lib^#^Dlibboost_serialization-vc140-mt-s-x64-1_67.lib^#^Duuid.lib^#^Duuid.lib^#
The object file is expecting libboost_serialization-vc140-mt-s-x64-1_67.lib. When the build process tries to link the file, the linker spits out an error:
LINK : fatal error LNK1104: cannot open file 'libboost_serialization-vc140-mt-s-x64-1_67.lib'
However, boost built libboost_serialization-vc141-mt-s-x64-1_67.lib which is a different version than what the object file is expecting. I have tried to build the version that the object file is looking for, but I cannot seem to get boost to do so (each time I try, it skips all of the targets, even though I am specifying an alternative toolset).
How can I change the library version that the object file is expecting?
When I tried to build the "right" version of the serialization library, I had been using toolset=msvc-140. It should have been toolset=msvc-14.0. Sometimes I am dumb.

Installing boost 1.52 with VS2012

I followed these instructions to install boost and to compile all libraries:
https://www.quantnet.com/threads/tutorial-quantlib-boost-installation-in-visual-studio-2012.11891/
Boost Installation The Boost library can be downloaded here.
Currently, the latest version available is Boost 1.52.0. You can build
boost by following the instruction here.
Alternative you can download
a pre-built lib from here. Once downloaded, copy the installer into
the Boost 1.52.0 folder and run it. Rename the folder to lib once
done.
So I downloaded boost 1.52, then copied that to C:\Program Files (x86)\boost\
I then downloaded the 1.52 64 bit installer and once downloaded, pasted that to:
C:\Program Files (x86)\boost\boost_1_52_0\boost_1_52_0\
I executed the installer- it said "extracting" and then many library names.
I then renamed the last folder to lib, so that I had:
C:\Program Files (x86)\boost\boost_1_52_0\lib\
In my VS2012 I then added the previous directory to my project. The project then starting parsing through the libraries and I had no linker errors. However, when building the project I still got:
LINK: fatal error LNK1104: cannot open file
'libboost_date_time-iw-mt-gd-1_52.lib'
(The only usage of boost in my project is file_mapping and mapped_region)
Help?
EDIT: I am aware about some libraries needing to be compiled separately in boost. I thought the above was to achieve this? If not, could someone please advise how because this really becomes a pain.
Boost has some libraries (most of them) used as source headers (.h files) that do not need to be pre-compiled, but there are also some libraries that need to be pre-compiled (.lib files). You can either download the libraries pre-compiled from the Boost website (http://www.boostpro.com/download/), although you might get some older versions from there, or compile them (the latest version or any of those available you want) on your own, although please have in mind that this might take some time, depending on your computer specs. See here for more: http://www.boost.org/doc/libs/1_54_0/libs/regex/doc/html/boost_regex/install.html.
After downloading the "normal" boost package, put the folders/files extracted on a folder and then assocciate it in VS2012 by putting the folder path in
(YourProject > Right-Click > Preferences >)General > VC++ Directories > Include Directories.
Then download and install the pre-compiled libraries (extract them on a folder) and then associate this folder with the VS, in
(YourProject > Right-Click > Preferences >) Linker > General > Additional Library Directories.
Of course, as mentioned before, you can also compile the packages you want, and then associate them with Visual Studio the same way.

BOOST Version 1.46.1 with Visual Studio 2010 P.E

I'm trying to run some simple examples with Boost and I'm continuously running into this error and I have tried to compile this but I haven't been able to create "libboost_system-vc100-mt-gd-1_46_1.lib".
I keep ending up with this issue:
error LNK1104: cannot open file 'libboost_system-vc100-mt-gd-1_46_1.lib'
Anyone encounter this error before? How do you compile this properly with NMAKE because it keeps telling me it's bulding "boost.regex without ICU / Unicode Support" which is giving it a "fatal error U1073 and tells me it doesn't know how to make "../src/c_regex_traits.cpp".
Sorry if this is a jumble it's just a lot of information that's getting more and more confusing to me.
Your boost is not properly built or installed. Please follow the instruction on how to install boost.
You need to build the boost libraries first.
To do this, open command line & go to boost root eg C:\dev\boost\1_46_1.
Depending on whether you want to build for 64bit or 32bit applications, type
(x64):bjam toolset=msvc address-model=64 variant=debug,release link=static threading=multi runtime-link=static,shared stage
(x86): bjam toolset=msvc variant=debug,release link=static threading=multi runtime-link=static,shared stage
to start compiling. Be patience while boost is building, it takes a lot of time. When building is complete you can find the library files in "stage\lib" folder.
Also note that you can delete the folder "bin.v2" once building is complete.
Now you need to point your VS2010 project to those libraries. Modifying part of mlimber's answer:
In VS2010, right-click on your project, select Properties and then go to Configuration Properties -> Linker -> General. Look for "Additional Library Directories" in the middle of the list, and add C:\Program Files\Boost\boost_1_46_1\lib (or whatever) there.
Another way to do this is the following
In VS2010, right-click on your project, select Properties and then go to Configuration Properties -> VC++ Directories. Look for "Library Directories" in the middle of the list, and add C:\Program Files\Boost\boost_1_46_1\lib (or whatever) there.
Apart from the above, one could also download from
http://sourceforge.net/projects/boost/files/boost-binaries/1.46.1/
the necessary libraries (including the file missing).
While trying to build Pion network library, I ran into a very similar problem since Pion has dependency on Boost library.
My Boost build was built using boostrap and bjam, and not BoostPro.
The error I got was this: LINK : fatal error LNK1104: cannot open file 'boost_thread-vc100-mt-gd-1_46_1.lib'
When I looked at C:\OpenSource\boost_1_46_1\stage\lib directory, I saw every file name started with libboost_ and not boost_. The file boost_thread-vc100-mt-gd-1_46_1.lib was clearly missing. That made me suspicious that not all boost libraries were built by bjam. After a little research, I reran bjam with the option --build-type=complete
Now I noticed that it started creating lib file names starting with boost_. Not to mention, Pion library could now compile successfully.
Hope this adds some clarity to this thread.
Or alternatively to ybungalobill's suggestion use the installer from www.boostpro.com.
In the installer you must just select the boost versions for msvc 10 and after installation update your visual studio include and lib directories in the VS2010 property sheets to point to the boost include and lib directory.
I take it that you used the BoostPro installer, but which library types did you install -- header only, static linking, DLLs, everything?
Assuming you did everything, then the problem is probably that you don't have the path to boost in your library paths. The problematic file name starts with "libboost" which tells me you're trying to use the statically linked version, which is fine. You should add the library path to your Makefile or project settings for all build configurations. It's probably something like C:\Program Files\Boost\boost_1_46_1 (for the newest version on a 32-bit version of Windows).
In VS2010, right-click on your project, select "All Configurations" at the top, then go to Configuration Properties | Linker [or Librarian if you're making a library] | General. Look for "Additional Library Directories" in the middle of the list, and add C:\Program Files\Boost\boost_1_46_1\lib (or whatever) there.
Do that for each project in the solution that uses Boost libraries that are not header-only.
For a Makefile, you'll have to locate the library paths and add Boost to it similarly but by hand.

Linking with boost .lib

I'm getting a link time error fatal error LNK1104: cannot open file 'libboost_serialization-vc80-mt-gd-1_44.lib' I recently downloaded boost which came with boost_serialization-vc80-mt-gd-1_44.lib but the compiler seems to be looking for one starting with libboost so i renamed it. but then it fails to find .dll at runtime. I tried to rename the dll but doesn't seem this helps.
While loading dll: An unhandled non-continuable STATUS_DLL_NOT_FOUND exception was thrown during process load
There are many different versions of each boost library: multi-threaded, single-threaded, static, dynamic, etc. The ones starting with "lib" are the static libraries, the ones without "lib" are the lib files used to link to the DLL versions. You can see this by looking at the lib file size.
If you are auto-linking boost, it means that the linker is looking for the static version of serialization. If you don't have such a file, it means you didn't build it. Another alternative is to use the installer available at http://www.boostpro.com. It allows you to select which boost libraries (static, dynamic, ST, MT, VS Version, etc) to download and install.
The other option is to disable auto-linking: see this post on the boost mailing list: http://lists.boost.org/boost-users/2005/12/15697.php

Linking Boost gives me error

When trying to compile my solution with VS2010 I'm getting a compiler error:
"error LNK1104: cannot open file 'libboost_unit_test_framework-vc100-mt-gd-1_45.lib'"
I've tried to look for this file on hard drive but with no luck.
Why am I getting this error and how can I fix it?
you need to take precompiled Boost libraries for your system, e.g. from boostpro.com or build Boost yourself. Then add a path to Boost .lib's to your Linker paths
Some Boost libraries require building. As robin hood's answer notes, you can download an install with the binaries included, or you can build them yourself (which is slightly fiddly). See http://www.boost.org/doc/libs/1_45_0/more/getting_started/windows.html for an extensive discussion.