This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: linking problems when compiling with g++ using boost


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]