Boost logo

Boost-Build :

Subject: Re: [Boost-build] trying to compile a test project with boost.build which uses boost libraries
From: Geoff Hilton (geoff.hilton_at_[hidden])
Date: 2009-02-26 18:45:46


Steven Watanabe wrote:
> AMDG
>
> Geoff Hilton wrote:
>> Steven Watanabe wrote:
>>> /boost//filesystem refers to the library under bin.v2, rather than
>>> the library in the stage/lib directory. If you want to use prebuild
>>> libraries,
>>> you can use the boost module. (Try running bjam --help boost)
>>
>> Thanks for the response, I tried a few things and I evidently am still
>> completely and thoroughly confused. Using pre-built boost, do I need
>> to specify the libraries manually as per
>> http://beta.boost.org/doc/tools/build/doc/html/bbv2/tutorial/prebuilt.html
>> ? I imagine I should put all that in the site-config.jam as specified
>> in
>> http://beta.boost.org/doc/tools/build/doc/html/bbv2/recipies/site-config.html
>> ? How can I take advantage of boost's magic to simplify the lib
>> declarations as much as possible?
>>
>> I wish there was a "hello world v2" type example for this in the
>> documentation. :|
>
> The boost module contains the logic for declaring targets
> for the pre-built libraries. It has documentation
> describing how to use it.
>
> In Christ,
> Steven Watanabe

geoff_at_venus:~/testmake$ echo $BOOST_ROOT $LD_LIBRARY_PATH
/usr/local/include/boost-1_38 :/usr/local/cuda/lib:/usr/local/lib

Aha! I finally got it to compile correctly. Here's the resulting jamroot
file:

--jamroot.jam--
import boost ;
boost.use-project ;
exe testmake
  : testmake.cpp
  : <library>/boost//filesystem
    <library>/boost//system
    <threading>multi
  ;

--testmake.cpp--
#include "testmake.hpp"
#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
#include <iostream>

namespace fs = boost::filesystem;

int main(int argc, char* argv[])
{
   if (argc < 2) {
     std::cout << "Hello world." << std::endl;
     boost::shared_ptr<int> intPtr;
   } else {
     for (int i = 1; i < argc; ++i) {
       fs::path file = fs::path(argv[i]);
       std::cout << file.native_file_string();
       if (fs::exists(file)) {
         std::cout << " exists.";
       } else {
         std::cout << " doesn't exist.";
       }
       std::cout << std::endl;
     }
   }
   return 0;
}

Thanks for the help!


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk