Cannot find C++ library when linking, error compliling the `boost::program_options` example -
I'm trying to compile to compile on my computer. I'm fully updating Xubuntu Lucid Lynx.
It will compile with no problem with g ++ -c mult_sources.cpp
, but when I try to link and remove with G ++ I get multiple_sources.o
I see:
multiple_source C.PP: (.text + 0x3d): `promotion: program_option :: option_details :: m_default_line_length 'multi_sources.cpp Undefined Reference: (.text + 0x87): 'Prompt: Program_option :: Options_ Details :: Options_details (std :: basic_string & lt; char, std :: char_traits & lt; char & gt ;, std :: allocation & lt; Char & gt; & gt; CONST & Amp ;, unsigned int) 'multiple_sources.cpp :( text + 0x15a): `Prompt :: program_option :: option_details :: add_options ()' undefined reference to 'multiple_sources.cpp :( .text + 0x17b) :: Undefined context of program_points :: options_description_easy_init :: operator () (thief cons *, four-cons *) 'multiple association. CPP. (Text + 0x193): `Prompt :: Programmap :: Options_description_easy_init :: oper Ator () (char const *, char const *) 'multiple_sources.cpp :( .text + 0x1af) for the undefined reference:` boost :: program_point Undefined reference (char const *, boost :: program_options:: value_semantic const *, char const *) 'multiple_sources.cpp :( .text + 0x1eb) for: options_description_ic_nit :: operator (): `boost :: program_option :: Option_details :: M_default_line_length 'multiple_socpppp Undefined reference to (text + 0x252): Undefined reference `boost :: program_opathy :: options_ description :: options_details (std :: basic_string & lt; char, std :: char_traits & lt; char & gt ;, std :: allocator & Lt; char & gt; Const & amp;, unsigned int) ... ...
At at News
I have a library installed:
& gt; Ls -l / usr / lib / libobost_program_option * -r-r-r-r1 root root 640800 2010-03-31 21:19 / UTR / lib / libobost_program_option. ARLWXRVX1 root root 26 2010-04-09 00:57 /usr/lib/libboost_program_options-mt.a - & gt; Libboost_program_options.a lrwxrwxrwx 1 root root 34 2010-04-09 00:57 /usr/lib/libboost_program_options-mt.so- & gt; Libboost_program_options.so.1.40.0 lrwxrwxrwx 1 root root 34 2010-04-09 00:57 /usr/lib/libboost_program_options.so- & gt; Libboost_program_options.so.1.40.0 -RW-R-R-1 root root 289336 2010-03-31 21:19 / url / lib / libobost_program_options.sof.1.40.0
After reading the ++ man page, I also tried:
-
G ++ -libbost_program_popathy multi_sources.cpp
-
++ -libboost_program_options. A multi-source CPP
-
G ++ -libboost_program_options.so mult_sources.cpp
- and above all
-L / usr With / l>
/ usr / bin / ld: can not be found -llibboost_program_options.so collect2: ld 1 exit status
What am I doing wrong?
-l
is the worst thing; Get rid of lib
pre-fix and use -lboost_program_options
.
Linker hopes to leave all the libraries lib
, and to leave you while specifying the library.
You can also include the full path to the library in the -l
list (such as / usr / lib
.
Comments
Post a Comment