Newbie: Building boost with Visual Studio 2008

Hi I have a question about building boost 1.43 with Visual Studio 2008. I have performed the following steps: 1) Downloaded and extracted boost_1_43_0.zip to C:\boost_1_43_0. 2) Built bjam (using tools\jam\src\build.bat). 3) Ran bjam in C:\boost_1_43_0 bjam ran successfully but the resulting tree contains .obj files but not all .lib files (for example, the RegEx libs are missing). I then ran: bjam.exe install This created folder c:\Boost, which does contain all the libraries and successfully links with the RegEx example program in 'boost: Getting Started on Windows'. That article ('boost: Getting Started on Windows') does not specify that I should run bjam install. Why was 'install' necessary in my case? Now I do not know whether to use C:\boost_1_43_0, which contains the headers and documentation, or C:\Boost, which contains the headers and libraries, as boost root. Obviously, if I choose the former, I need to fix it's build process. I want a solution that I can recommend to our development team. Please can someone advise me what is best practice? Best regards David

On 07/07/2010 11:55, David Aldrich wrote:
Hi
I have a question about building boost 1.43 with Visual Studio 2008. I have performed the following steps:
1) Downloaded and extracted boost_1_43_0.zip to C:\boost_1_43_0. 2) Built bjam (using tools\jam\src\build.bat).
Well, it's normally by running bootstrap.bat at <BOOST_ROOT>/ but okay.
3) Ran bjam in C:\boost_1_43_0
bjam ran successfully but the resulting tree contains .obj files but not all .lib files (for example, the RegEx libs are missing).
What is your exact command? That would help people to help you. Are you sure you didn't have all the necessary files there? It's (by default) in <BOOST_ROOT>/stage/lib/ where the resulting .dll & .lib are placed. <BOOST_ROOT>/bin.v2 is (by default) the working directory for bjam. KTC

Hi KTC Thanks for your reply.
Well, it's normally by running bootstrap.bat at <BOOST_ROOT>/ but okay.
Ok, I have built bjam that way now.
What is your exact command?
I just ran 'bjam'. That does indeed place the libraries in <BOOST_ROOT>/stage/lib/. So all is well now and my original question is answered. Thanks. Some RegEx example code runs fine but I have a problem building a Boost.Python example. The libraries in <BOOST_ROOT>/stage/lib/ include: libboost_python-vc90-mt-gd-1_43.lib I am now trying to run the example in the boost.python 'EmbeddingPython wiki page, which begins: #include <boost/python.hpp> using namespace boost::python; int main( int argc, char ** argv ) { try { Py_Initialize(); [snip] When I build it I get error: LINK : fatal error LNK1104: cannot open file 'boost_python-vc90-mt-gd-1_43.lib' Why does the linker want a library file beginning 'boost_python' when bjam has generated library files beginning 'libboost_python' ? Best regards David

AMDG David Aldrich wrote:
When I build it I get error:
LINK : fatal error LNK1104: cannot open file 'boost_python-vc90-mt-gd-1_43.lib'
Why does the linker want a library file beginning 'boost_python' when bjam has generated library files beginning 'libboost_python' ?
The linker is looking for the import library for a DLL. You can build this with bjam --with-python link=shared or you can compile your project with -DBOOST_PYTHON_STATIC_LIB (Boost.Python uses different auto-link conventions from the rest of Boost) In Christ, Steven Watanabe

Hi Steven Thanks for your reply.
The linker is looking for the import library for a DLL. You can build this with bjam --with-python link=shared
I chose this solution and the project now builds successfully. However, when I run the project's executable I get: "This application failed to start because boost_python-vc90-mt-gd-1_43.dll was not found" So we have satisfied the linker but not the runtime. Please can you advise me how to fix this problem? Best regards David

AMDG David Aldrich wrote:
The linker is looking for the import library for a DLL. You can build this with bjam --with-python link=shared
I chose this solution and the project now builds successfully.
However, when I run the project's executable I get:
"This application failed to start because boost_python-vc90-mt-gd-1_43.dll was not found"
So we have satisfied the linker but not the runtime. Please can you advise me how to fix this problem?
You need to add the library directory to your PATH. In Christ, Steven Watanabe
participants (3)
-
David Aldrich
-
KTC
-
Steven Watanabe