Boost logo

Boost Users :

Subject: [Boost-users] [program_options] linking error with example
From: katharina (KathiS_at_[hidden])
Date: 2010-01-12 09:51:43


Hi,

I have problems starting out with the program_options library.
Looking at the tutorial, I wanted to try out the first example metioned,
 first.cpp (which is located in boost_1_41_0/libs/program_options/example).

But there seems to be some linking error.
I try to compile it by
 g++ -I ~boost_1_41_0 first.cpp -o first
~/boost_1_41_0/stage/lib/libboost_program_options.a

But then I get a strange error:
/tmp/ccDB6KSC.o: In function
`boost::program_options::basic_command_line_parser<char>::extra_parser(boost::function1<std::pair<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::allocator<boost::function_base> >)':
first.cpp:(.text._ZN5boost15program_options25basic_command_line_parserIcE12extra_parserENS_9function1ISt4pairISsSsERKSsSaINS_13function_baseEEEE[boost::program_options::basic_command_line_parser<char>::extra_parser(boost::function1<std::pair<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::allocator<boost::function_base> >)]+0x27): undefined
reference to
`boost::program_options::detail::cmdline::set_additional_parser(boost::function1<std::pair<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::allocator<boost::function_base> >)'
collect2: ld returned 1 exit status

What am I doing wrong?

Thanks,
Katharina


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