Sunday 10 June 2018

Install and build Boost library in Linux



I'm following the Boost Getting Started article.

I've installed it with Bjam and I could see include files and library files (.a, .so).



#include 
#include
#include

int main()
{
std::string line;
boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );

}


If I build above code using this command



g++ -I./boost/include -L./boost/lib -lboost_regex-gcc43-mt -static -o test_boost2 test_boost2.cc


I get this error:




/tmp/ccJFVVid.o: In function `boost::basic_regex > >::assign(char const*, char const*, unsigned int)':
test_boost2.cc:(.text._ZN5boost11basic_regexIcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE6assignEPKcS7_j[boost::basic_regex > >::assign(char const*, char const*, unsigned int)]+0x22): undefined reference to `boost::basic_regex > >::do_assign(char const*, char const*, unsigned int)'
collect2: ld returned 1 exit status


It was working okay under my Windows machine.



What's wrong?



gcc version 4.3.2 (Debian 4.3.2-1.1)




Linux xxxxxxxx 2.6.26-1-686 #1 SMP Fri Mar 13 18:08:45 UTC 2009 i686 GNU/Linux


Answer



I found the problem! g++ command problem! :( sorry.
If I move back -l option to the end of the line, it does not complain more :)


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...