delorie.com/archives/browse.cgi | search |
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 |
From: | "Dave Korn" <dk AT artimi DOT com> |
To: | <cygwin AT cygwin DOT com> |
Subject: | RE: Problem linking with ODBC |
Date: | Thu, 19 Aug 2004 10:28:41 +0100 |
MIME-Version: | 1.0 |
In-Reply-To: | <loom.20040818T214320-21@post.gmane.org> |
Message-ID: | <NUTMEGyLyGqOs28evcM00000e49@NUTMEG.CAM.ARTIMI.COM> |
X-OriginalArrivalTime: | 19 Aug 2004 09:28:41.0484 (UTC) FILETIME=[EA5B84C0:01C485CE] |
> -----Original Message----- > From: cygwin-owner On Behalf Of da > Sent: 18 August 2004 20:48 > I'm getting undefined references when trying to link with > libodbc32.a that comes with cygwin: > > --- > > Building target: libTest.so > g++ -shared -o libTest.so testdb.o -lodbc32 > testdb.o(.text+0x40): In function `_Z3foov': > /cygdrive/c/Projects/test/source/Debug/../testdb.cpp:7: > undefined reference to > `_SQLConnect' > collect2: ld returned 1 exit status > make: *** [libTest.so] Error 1 > > --- > > Any idea why _SQLConnect is unresolved? Here's how to find out: use nm to list the library contents and see what's there. dk AT mace /artimi> nm /lib/w32api/libodbc32.a | grep SQLConnect 00000000 T _SQLConnectW AT 28 00000000 I __imp__SQLConnectW AT 28 00000000 T _SQLConnectA AT 28 00000000 I __imp__SQLConnectA AT 28 00000000 T _SQLConnect AT 28 00000000 I __imp__SQLConnect AT 28 dk AT mace /artimi> It seems it's not matching because the symbol is decorated. There's an ld option to deal with this: --enable-stdcall-fixup Link _sym to _sym AT nn without warnings To pass it through the g++ command line, you'll need to prefix it with -Wl, so try it like this: > g++ -Wl,--enable-stdcall-fixup -shared -o libTest.so testdb.o -lodbc32 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 |