linking problems when compiling with g++ using boost
Gerrit P. Haase
gerrit@familiehaase.de
Sat Nov 5 23:58:00 GMT 2005
Cameron Wood wrote:
> I have installed a vanilla install of cygwin which includes boost
> 1.33. I have a simple application which compiles and runs on another
> system fine. However using cygwin it complains about undefined
> references to all the boost objects and functions.
>
> I can see the exact functions/objects that its complaining about when
> I do an nm on the apparent missing boost library:
> 00000070 T boost::program_options::options_description::add_options()
>
> my compilation is:
> g++ -I/usr/include/boost-1_33 -L/usr/lib
> -lboost_program_options-gcc-mt-s -lboost_regex-gcc-mt-s
> getStats.C
> (the library is in fact in /usr/lib)
You must put the libraries in front of the linker search path (the
linker searches the command line from right to left), try:
g++ -c -I/usr/include/boost-1_33 -o getStats.o getStats.C
g++ -o getStats getStats.o -lboost_program_options-gcc-mt-s \
-lboost_regex-gcc-mt-s
> with errors like:
> o:getStats.C:(.text+0x26b): undefined reference to
> `boost::program_options::options_description::add_options()'
>
> One thing I don't get are the different suffixes on the end of the
> boost libraries. Any help regarding this would greatly be
> appreciated!
> Thanks,
> Cameron
Hth,
Gerrit
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list