[program_options] linking error with example

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

katharina wrote:
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
Unless you insist on linking statically, try export BOOST_INC=~/boost_1_41_0 export BOOST_LIBS=~/boost_1_41_0/stage/lib g++ -I $BOOST_INC first.cpp -o first -L$BOOST_LIBS -lboost_program_options HTH Christoph

Christoph Duelli wrote:
katharina wrote:
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
Unless you insist on linking statically, try
export BOOST_INC=~/boost_1_41_0 export BOOST_LIBS=~/boost_1_41_0/stage/lib g++ -I $BOOST_INC first.cpp -o first -L$BOOST_LIBS -lboost_program_options
I tried it - seems to compile ok, but when I try to run the program, I get "error while loading shared libraries: libboost_program_options.so.1.41.0: cannot open shared object file: No such file or directory" But the library is there... Best, Katharina

export BOOST_INC=~/boost_1_41_0 export BOOST_LIBS=~/boost_1_41_0/stage/lib g++ -I $BOOST_INC first.cpp -o first -L$BOOST_LIBS - lboost_program_options
I tried it - seems to compile ok, but when I try to run the program, I get "error while loading shared libraries: libboost_program_options.so.1.41.0: cannot open shared object file: No such file or directory" But the library is there...
Try adding -R$BOOST_LIBS to the link line. This should include a runtime path to be looked when loading the library. :-)

export BOOST_INC=~/boost_1_41_0 export BOOST_LIBS=~/boost_1_41_0/stage/lib g++ -I $BOOST_INC first.cpp -o first -L$BOOST_LIBS - lboost_program_options
I tried it - seems to compile ok, but when I try to run the
Hi, You may also add the boost libraries directory to your LD_LIBRARY_PATH via export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BOOST_LIBS Regards Tobias On Monday 18 January 2010 07:07:25 pm Rangarajan, Kumar wrote: program, I
get "error while loading shared libraries: libboost_program_options.so.1.41.0: cannot open shared object file: No such file or directory" But the library is there...
Try adding -R$BOOST_LIBS to the link line. This should include a runtime path to be looked when loading the library.
:-)
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- __________________________ Tobias Columbus t.columbus@gmx.de

Rangarajan, Kumar wrote:
export BOOST_INC=~/boost_1_41_0 export BOOST_LIBS=~/boost_1_41_0/stage/lib g++ -I $BOOST_INC first.cpp -o first -L$BOOST_LIBS - lboost_program_options
I tried it - seems to compile ok, but when I try to run the program, I get "error while loading shared libraries: libboost_program_options.so.1.41.0: cannot open shared object file: No such file or directory" But the library is there...
Try adding -R$BOOST_LIBS to the link line. This should include a runtime path to be looked when loading the library.
:-)
Hmm, from that I get g++: unrecognized option '-R/home/username/boost_1_41_0/stage/lib'... But anyway it worked with Tobias' solution now. Best, Katharina
participants (4)
-
Christoph Duelli
-
katharina
-
Rangarajan, Kumar
-
Tobias Columbus