Boost logo

Boost Users :

From: Javier-Elias Vasquez-Vivas (javier.e.vasquez.vivas_at_[hidden])
Date: 2005-03-06 12:04:18


Actually I tried generating the object file which is possible:

c++ -I$PATH1/include/boost-1_32 -L$PATH1/lib -c credit_card_example.cpp

This provides me with credit_card_example.o.  Then when it comes to the linking stage all the whole bunch of error messages show up:

c++ -I$PATH1/include/boost-1_32 -L$PATH1/lib credit_card_example.o -o trial

Then someone in the list indicated I at least needed to indicate I want to link regex library, and "-l" was indicated for that purpose:

c++ -I$PATH1/include/boost-1_32 -L$PATH1/lib -llibboost_regex-gcc credit_card_example.o -o memo

I'm not sure why this is necessary, but it works, but it links using the dynamic library, something I surely do NOT want (I want a statically linked executable with no dependancies).  So then I tried -static:

c++ -I$PATH1/include/boost-1_32 -L$PATH1/lib -static -lboost_regex-gcc credit_card_example.o -o memo

And I got a whole bunch of error messages again:

       1 credit_card_example.o: In function `boost::basic_regex<char, boost::regex_traits<char>, std::allocator<char> >::bas
       1 ic_regex[in-charge](char const*, unsigned, std::allocator<char> const&)':
       2 credit_card_example.o(.gnu.linkonce.t._ZN5boost11basic_regexIcNS_12regex_traitsIcEESaIcEEC1EPKcjRKS3_+0x22): undefi
       2 ned reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::reg_expression[not
       2 -in-charge](char const*, unsigned, std::allocator<char> const&)'
          ...
      58 credit_card_example.o: In function `boost::basic_regex<char, boost::regex_traits<char>, std::allocator<char> >::~ba
      58 sic_regex [in-charge]()':
      59 credit_card_example.o(.gnu.linkonce.t._ZN5boost11basic_regexIcNS_12regex_traitsIcEESaIcEED1Ev+0xd): undefined refer
      59 ence to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::~reg_expression [not-in-cha
      59 rge]()'
      60 collect2: ld returned 1 exit status

When I read the documentation for "-l" I found "
The linker searches a standard list of directories for the library, which is actually a file named liblibrary.a. The linker then uses this file as if it had been specified precisely by name.", so I'm confused why the dynamic library is being used...  Any ways, I used -static, and it didn't work when it should ("On systems that support dynamic linking, this prevents linking with the shared libraries").

1st thing is indications on what I need to be able to get a static linkage, and 2nd maybe a clarification about specifying the boost libraries...

Besides this static/dynamic problem, I'm wondering why I need to specify the boost libraries to use (that's not required for std libraries at all).  If one requires several boost libraries, then are all them to be specified as well?

Please include my e-mail in your replies, so I can soon and easily get them...


Thanks a lot,

Javier.


Javier-Elias Vasquez-Vivas wrote:
Hi all,

I'm new at using boost.  I was able to compile it and install it with "--prefix".  The reason to use "--prefix" is not having root access...  I used the following bjam command to compile:

bjam --prefix=$PATH1 install

Then I got under $PATH1 the following stuff:

$PATH1/lib/<all_boost_libraries>
$PATH1/include/boost-1_32/boost/<all_boost_libraries_headers>   (including regex.hpp and its sub-directory)

So I copied credit_card_example.cpp in $PATH2 and tried to compile it as follows:

g++ -I$PATH1/include/boost-1_32 -L$PATH1/lib
credit_card_example.cpp

After this I got a bunch of error messages I'm attaching inside file regex_cmp_failure.log...  In the 1st lines we notice:

       1 /netbatch/ccwCZTMX.o: In function `boost::basic_regex<char, boost::regex_traits<char>, std::allocator<char> >::basi
       1 c_regex[in-charge](char const*, unsigned, std::allocator<char> const&)':
       2 /netbatch/ccwCZTMX.o(.gnu.linkonce.t._ZN5boost11basic_regexIcNS_12regex_traitsIcEESaIcEEC1EPKcjRKS3_+0x22): undefin
       2 ed reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::reg_expression[not-
       2 in-charge](char const*, unsigned, std::allocator<char> const&)'

And in the last lines:

      59 /netbatch/ccwCZTMX.o(.gnu.linkonce.t._ZN5boost11basic_regexIcNS_12regex_traitsIcEESaIcEED1Ev+0xd): undefined refere
      59 nce to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> >::~reg_expression [not-in-char
      59 ge]()'
      60 collect2: ld returned 1 exit status

I'm not familiar with boost, but it looks like this is a header or a library problem...  Notice /netbatch is just working as /tmp.

I also tried modifying credit_card_example.cpp including the config.hpp header, but the result was the same...

Is any one aware of what I might be doing wrong, so that can indicate how to do things right?  Please reply including my e-mail (javier.e.vasquez.vivas@intel.com) so that I can grab any answers...

Thanks,

Javier.


-------- Original Message --------
Subject: Failure output from compilation...
Date: Sat, 5 Mar 2005 10:38:36 -0600 (CST)
From: Javier Vasquez vivas - BMD ~ <jevasque@pcocd2.intel.com>
To: javier.e.vasquez.vivas@intel.com


Javier-Elias Vasquez-Vivas

  

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net