Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build Boost::program_options

I wanted to use boost::program_options. After I installed boost, I think that I have to build separatly program_options (http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html). But I don't know how to do it.

I am trying to compile the C:\Program Files\boost\boost_1_42\libs\program_options\example\first.cpp (http://www.boost.org/doc/libs/1_42_0/doc/html/program_options/tutorial.html) but probably due to I didn't build the library I have this error:

LINK : fatal error LNK1104: cannot open file 'libboost_program_options-vc90-mt-gd-1_42.lib' 

EDIT: I used the installers supplied by BoostPro Computing so I skipped the installation of the binaries (http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html#install-visual-studio-binaries)

EDIT: I also followed the instructions at http://www.boost.org/doc/libs/1_43_0/more/getting_started/windows.html#build-from-the-visual-studio-ide

like image 451
legami Avatar asked Jun 25 '10 12:06

legami


2 Answers

After reading the Boost 1.54 Getting Started on Windows guide these are the steps that you should take (program_options is a header only library). You need to have a MSVC compiler installed.

  1. Download Boost's source code from here and install it.

  2. From a command line (preferably the Developer Command Prompt for VS):

    bootstrap.bat

    bjam.exe --build-type=complete msvc stage --with-program_options

This will finish in a couple of minutes and that's it! The libraries are located in the directory .\bin.v2\libs\program_options\build.

BTW you could see which libraries you can build using bjam --show-libraries.

like image 152
lmiguelmh Avatar answered Sep 30 '22 11:09

lmiguelmh


I've followed these steps and it worked pretty well. That is to build the few boost libraries that must be built separately.

I suggest you read the entire document.

like image 23
f4. Avatar answered Sep 30 '22 09:09

f4.