boost build finish with missing some files - c++

my environment is next:
windows 7 ultimate x64
visual studio 2010 ultimate sp1
and using boost 1.55.0
get boost from boost.org (.zip) and follow next step to install
in administrator command :
c:\boost_download_folder>booststarp.bat
...
c:\boost_download_folder>b2 toolset=msvc-10.0 variant=debug,release link=static threading=multi address-model=32 runtime-link=static
...
c:\boost_download_folder>b2 toolset=msvc-10.0 variant=debug,release link=shared threading=multi address-model=32 runtime-link=shared
and it makes about 3g of files.
and i copied it to my project and include.
linker->general->Additional library directories : $(SolutionDir)\boost_1_55_0\lib;$(SolutionDir)\boost_1_55_0\stage\lib;
c/c++->additional include directories : $(SolutionDir)\boost_1_55_0
everything succeess and header file finding is fine.
but only error happen it is
LINK : fatal error LNK1104: 'libboost_system-vc100-mt-gd-1_55.lib'
i find deep and deep and finally i found it. the builded library folder has no libboost_system-vc100-mt-gd-1_55.lib file. i searched this file in Explorer but no libboost_system-vc100-mt-gd-1_55.lib is included in boost_1_55_0 folder.
but the next file is exist :
bin.v2\libs\system\build\msvc-10.0\release\address-model-32\link-static\runtime-link-static\threading-multi\libboost_system-vc100-mt-s-1_55.lib
stage\lib\libboost_system-vc100-mt-s-1_55.lib
bin.v2\libs\system\build\msvc-10.0\release\address-model-32\link-static\runtime-link-static\threading-multi\libboost_system-vc100-mt-s-1_55.lib.rsp
bin.v2\libs\system\build\msvc-10.0\debug\address-model-32\link-static\runtime-link-static-threading-multi\libboost_system-vc100-mt-sgd-1_55.lib
stage\lib\libboost_system-vc100-mt-sgd-1_55.lib
bin.v2\libs\system\build\msvc-10.0\debug\address-model-32\link-static\runtime-link-static-threading-multi\libboost_system-vc100-mt-sgd-1_55.lib.rsp
i think it missed with build. what i missed?? please help me

Related

Boost.Python not the .lib

I think I have built it properly. I have other boost libraries working. I am getting the following error
Error: SNK1104 cannot open file 'boost_pythonPY_MAJOR_VERSIONPY_MINOR_VERSION-vc141-mt-x32-1_67.lib'.
I'm on windows using Visual Studios, with boost 1.67
boost-python is notoriously hard to install. Make sure you specify with-python when building from source. Something like this:
Download and configure boost
cd boost_1_55_0\tools\build\v2\engine
build.bat mingw
Add this to your path
C:\boost_1_55_0\tools\build\v2\engine\bin.ntx86
Build from source
bjam toolset=gcc --with-python link=shared
Add this to your path
C:\boost_1_55_0\stage\lib

boost linker error wrong toolset

there are many questions related to this but none so far is a solution in my case.
I built boost 1.63 libraries with VS 2017, using toolset 14.1
The command line for building boost libs is:
bjam --toolset=msvc-14.1 --build-dir="libs" --stagedir="x64" --build-type=complete stage address-model=64 threading=multi link=static runtime-link=static
The 2nd lib in the build folder is
libboost_atomic-vc141-mt-sgd-1_63.lib
My project using boost is pointing to this folder. But linking with VS 2017
and Toolset 14.1 selected throws an error:
LINK : fatal error LNK1104: cannot open file 'libboost_atomic-vc140-mt-sgd-1_63.lib'
As you can see, only the toolset in incorrect.
Is there an additional switch and where to find ? Thank you.
One comment: i built the bjam.exe with project-config.jam setting
using msvc : 14.1;
and libraries been built lightning fast: Below 20 seconds for all x64 libraries!
Boost 1.63 hasn't been made compatible with Visual Studio 2017, so there's a few things you gotta do manually to fix things. In order to make sure it picks up the correct library files, you need to make edits to auto_link.hpp, which is found in boost/config. Change these lines:
# elif defined (BOOST_MSVC)
// vc14:
# define BOOST_LIB_TOOLSET "vc140"
To this:
# elif defined (BOOST_MSVC) && (BOOST_MSVC < 1910)
// vc14:
# define BOOST_LIB_TOOLSET "vc140"
# elif defined (BOOST_MSVC)
// vc15:
# define BOOST_LIB_TOOLSET "vc141"
And then do a clean recompile of the boost libraries, and replace the original version of this file in your includes with this modified version.

how to install boost correctly

I've downloaded boost_1_61_0 and unzipped it.
I used bootstrap.bat generating b2.exe and bjam.exe and successfully built libraries in a folder named "stage" for both x64 and win32.
After I have .lib and boost folders containing include files.
When I remove the root folder I can't build my program.
Why am I unable to build the code?
I have used bs as:
b2 -j8 toolset=msvc-14.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/x64 install
It creates C:\boost that contains libs and header files. But when I try to use this new folder in my project I get errors: couldn't find eg: boost/reg.hpp
Is there a correct way to install boost after building it?
I figured it out:
extract boost_1_61_0 for example to C: so new folder named "C:\boost_1_61_0"
from a command prompt or visual studio 2015-> Visual studio tools-> developer command prompt for ms2015 (run it as administrator)
cd C:\boost_1_61_0
bootstrap.bat
So new files are created: b2.exe and bjam.exe in the root folder. Now we build the x64 version of boost library:
b2 -j8 toolset=msvc-14.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/x64
new folder "Stage" is created in root folder, inside this folder there's a folder named x64 inside which there's a folder "lib" (.lib files). the process takes some minutes (about 20 minutes)
when it's done a message tells you that boost_1_61_0 skips some targets, don't mind it's nothing because it belongs to other OSs
now we build the x86 version:
b2 -j8 toolset=msvc-14.0 address-model=32 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/win32
wait until it's done.
now we have the two versions x64 and win32 but the root folder is too much big about 5.3 gigabyte.
now we install these two libraries to "C:\Boost" and then clean by removing the folder "C:\boost_1_61_0":
b2 -j8 toolset=msvc-14.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=C:\Boost\x64 install
I add install and changes the name of folder from stage to "C:\Boost\X64"
when it's done a new folder "C:\Boost" is created it contains include folder and x64 folder which contains lib files.
now we install win32 version:
b2 -j8 toolset=msvc-14.0 address-model=32 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=C:\Boost\win32 install
when it's done remove a folder named lib inside: C:\Boost\
time to clean and free up memory:
remove the hole folder: C:\Boost_1_61_0 because we don't need it again
** how to add boost to my project?:
open Msvc2015->create c++ console new project, when it's created go to Project->
"MyBoostProject's" properties->C/C++->General->Additional include directories->edit->new folder->C:\Boost\include->boost_1_61
add another folder with the path: C:\Boost\include->Boost_1_61_0->Boost
now the include files are ready.
** How to link?:
If my project is x86:
go to: linker->General->Additional Library Directories->edit->Add new folder->C:\Boost\win32\Lib
If my project is x64:
linker->Additional library directories->edit->add new folder->C:\Boost\x64\Lib
I wish this post would be useful for anyone who was not able to install it.
The boost includes are in the folder you created called c:\boost. So the path is c:\boost\boost as it looks you have found out.
But better yet is to use environment variables.
You will find them under control panel > system > advanced >...
Set BOOST_ROOT to c:\boost and BOOST_LIB to your stage path. I keep all the builds v100, v140 x86 and 64 bit in the same folder. Then in your projects you can set additional include directories to $(BOOST_ROOT) and lib directories to $(BOOST_LIB)
This gets you lots of advantages like when 6.62 comes out you can put it in c:\boost_62 and change your environment variables then all your projects are using the new boost. You don't have to get stuck with c:\boost. And if you share the project with someone else with a different path, it just works.
BOOST_ROOT looks pretty universal out there, I don't know about BOOST_LIB
Also, if you change an environment variable, you will have to close Visual Studio and reopen it to have the change take affect.

Could not link boost file system

I use Visual Studio 2012 Update 4. I cannot build my project.
I've downloaded boost archive, extracted it to C:\boost.
Opened Developer Command Line for VS2012 and executed bootstrap.bat and bjam.exe in boost directory (took about 5 minutes).
In my project, i've added C:\boost to additional include directories and C:\boost\stage\lib to additional library directories (in build settings).
If i write in my code:
#include <boost\filesystem.hpp>
I get linkage error:
Error 1 error LNK1104: cannot open file 'libboost_filesystem-vc110-mt-gd-1_58.lib'
Project type is: Win32 application (CLR support).
Other boost headers seems to work well on other project.
What should i learn about linking boost what i am missing?
Fixed this issue by running this command in c:\boost (thanks #marom):
b2.exe --with-filesystem --toolset=msvc-11.0 --build-type=complete stage

Boost on windows with codeblocks - error: undefined reference to boost

Tons of these errors are popping up whenever I try to use boost in windows with codeblocks. On linux it works fine.
Even though I did add the boost .lib files and the include path to the GCC compiler in codeblocks.
I first compiled using bootstrap.bat + b2.exe but apperently that's wrong. A user in another forum said he fixed it but when I try his method I get:
So to clarify; what I did was:
. Add "C:\Program Files (x86)\CodeBlocks\MinGW\bin" to PATH
. Run bootstrap.bat which makes bjam.exe
. Run cmd.exe, cd to boost folder, enter bjam --build-dir=C:\boost --build-type=complete gcc stage
But then I get that error.
Why does compiling/using C++ libraries on windows always net these kind of errors that take hours to solve, while on linux it's nearly always flawless -.-
Who knows how to fix this one?
The technique that I use is as follows:
Set up the PATH environmental variable to include the bin directory of your GCC installation.
Extract boost somewhere.
Open a comand prompt and cd into the root of boost (the folder named boost_x_xx_x which has boost, doc, libs etc... subdirectories).
To compile boost, run:
bootstrap.bat
b2 toolset=gcc variant=release link=static threading=multi install
This will install boost to C:\Boost. If you want to install it elsewhere use the --build-dir= option when running b2.