delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/11/05/18:58:08

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <436D46FF.5020006@familiehaase.de>
Date: Sun, 06 Nov 2005 00:57:51 +0100
From: "Gerrit P. Haase" <gerrit AT familiehaase DOT de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915
MIME-Version: 1.0
To: Cameron Wood <ckwood AT gmail DOT com>
CC: cygwin AT cygwin DOT com
Subject: Re: linking problems when compiling with g++ using boost
References: <6b99f6c60511050751v75763393p795d8fb2025dcaf AT mail DOT gmail DOT com>
In-Reply-To: <6b99f6c60511050751v75763393p795d8fb2025dcaf@mail.gmail.com>
X-IsSubscribed: yes

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019