delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
From: | "Dave Korn" <dave DOT korn AT artimi DOT com> |
To: | <cygwin AT cygwin DOT com> |
References: | <14705301 DOT post AT talk DOT nabble DOT com> |
Subject: | RE: cygwin, g++ and boost? Do I need dll.a? |
Date: | Wed, 9 Jan 2008 12:43:09 -0000 |
Message-ID: | <00db01c852bd$30386d00$2e08a8c0@CAM.ARTIMI.COM> |
MIME-Version: | 1.0 |
X-Mailer: | Microsoft Office Outlook 11 |
In-Reply-To: | <14705301.post@talk.nabble.com> |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
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 |
On 09 January 2008 04:57, adam99 wrote: > After several trials with an hello world code an trying to link library, I > realized that I can not link anything in /lib without dll.a extension > > g++ -o hello -L/lib hello.cpp -llibcrypt > this works, since > ls /lib/libcrypt* > /lib/libcrypt.a /lib/libcrypt.dll.a > > g++ -o hello -L/lib hello.cpp -llibbfd > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot > find -llibbfd > collect2: ld returned 1 exit status > > fails as libbfd.dll.a does not exist; > ls /lib/libbfd* > /lib/libbfd.a /lib/libbfd.la Wrong reasoning. The actual problem is that you need to remove the 'lib' prefix when supplying a library name: > g++ -o hello -L/lib hello.cpp -lcrypt > g++ -o hello -L/lib hello.cpp -lbfd Ordinary .a files are for static linking, .dll.a files are for runtime linking against dlls, gcc selects the right one for you by using one of the -shared or -static flags. > none of the libboost have dll.a file; Yep, they are static libraries, there is no boost DLL. Get your -l option right and everything should be ok. > Could you tell me why I need dll.a files? The dll.a file is what is known as an import library. A standard .a file has all the library functions in it, and they are physically merged into your final program executable. An import library doesn't have the actual functions in it, just stubs that call at runtime to the DLL that actually implements a library. > Also how can I generate them for > the boost installation under cygwin You don't; the boost package links statically. (And 99% of it isn't linked at all; most of it works just by including the headers to get the templates and classes they define inline). cheers, DaveK -- Can't think of a witty .sigline today.... -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |