Boost logo

Boost Users :

From: Mikko Vainio (mivainio_at_[hidden])
Date: 2007-12-31 04:42:28


Try adding
-lboost_program_options
to the g++ command line options.

/Mikko

Eswar K wrote:
> Hi,
>
> I am a newbie to Boost. I am writing a sample code using the Boost
> libaries and am getting the following error during linking.
>
> _*Command Line Usage *_
> *
> */g++ -I /usr/include/boost/ example.cpp -o example.o/
>
> _*Code*_
>
> /#include <boost/lambda/lambda.hpp>
> #include <iostream>
> #include <iterator>
> #include <algorithm>
> #include <boost/program_options/options_description.hpp>
> #include <boost/program_options/positional_options.hpp>
> #include <boost/program_options/variables_map.hpp>
> #include <boost/program_options/parsers.hpp>
>
>
> #include <cstdlib>
> #include <iostream>
> #include <iomanip>
> #include <map>
> #include <string>
>
> using namespace boost::program_options;
> //namespace po = boost::program_options;
>
> int main()
> {
> using namespace boost::lambda;
> // using namespace boost::program_options;
> typedef std::istream_iterator<int> in;
>
> std::for_each(
> in(std::cin), in(), std::cout << (_1 * 3) << " " );
> option_description opts;
> }
> /
> _*Error Message*_
>
> /tmp/ccO0HWa7.o(.text+0xb0): In function `main':
> example.cpp: undefined reference to
> `boost::program_options::option_description::option_description()'
> /tmp/ccO0HWa7.o(.text+0xbf): example.cpp: undefined reference to
> `boost::program_options::option_description::~option_description()'
> collect2: ld returned 1 exit status
>
> $LD_LIBRARY_PATH has the following value set.
> /home/suhas/boost/lib:/usr/lib:/usr/include/boost/
>
> I am stuck, any help will be really appreciated.
>
> Thanks in advance.
>
> Regards,
> Eswar
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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