This is the mail archive of the
mailing list for the Cygwin project.
Re: Linking with .LIB files
- To: gnu-win32 at cygnus dot com, colin at bird dot fu dot is dot saga-u dot ac dot jp
- Subject: Re: Linking with .LIB files
- From: David W Palmer <David_W_Palmer at ccm dot jf dot intel dot com>
- Date: Wed, 26 Mar 97 10:39:00 PST
For those who are watching: Colin Peter's text is left justified, mine is
David W Palmer[SMTP:David_W_Palmer@ccm.jf.intel.com] wrote:
> So, I have a simple program which uses OpenGL and I link with the
> link simple.o libuser32.a glu32.lib opengl32.lib libgdi32.a
> /subsystem:windows /machine:i386
Although this may be secondary to your concerns, or in fact may be
totally off topic, I notice that libglu32.a and libopengl32.a are
both included with the beta 17.1 distribution. I'm not sure about
the header files, but if you can get your code to compile you should
be able to link it with ld. Of course this doesn't help if what you
really want is DirectX or some other thing that comes with .lib
files you can't convert to .a files.
Actually, that is interesting. From the distribution I downloaded,
libglu32.a and libopengl32.a are not available. However, I am
interested in the general problem of linking with MS lib's (ie,
I suspect that I could use dlltool to generate an import library for
glu32.dll and opengl32.dll. I'll give it a try.
> LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
> simple.exe : fatal error LNK1120: 1 unresolved externals
> make: *** [simple.exe] Error 25
> No .EXE is generated. And the answer is... what?
This suggests to me that you need to include crt0.o in your link line
explicitly, since that's where _WinMainCRTStartup should be resolved.
Well, actually in the Cygnus sources it's not, but you could just add
a _WinMainCRTStartup entry point which calls the _mainCRTStartup
entry point and it should work OK I think.
Yes, I thought of that too.
link simple.o crt0.o libuser32.a glu32.lib opengl32.lib libgdi32.a
Microsoft (R) 32-Bit Incremental Linker Version 5.00.7022
Copyright (C) Microsoft Corp 1992-1997. All rights reserved.
crt0.o : error LNK2001: unresolved external symbol _cygwin_crt0
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
simple.exe : fatal error LNK1120: 2 unresolved externals
make: *** [simple.exe] Error 25
So, I can trade WinMainCRTStartup() for cygwin_crt0(). Not much
progress. Though, this has to be defined somewhere! Which library?
Unfortunately, I don't know how to list the functions in a library.
(how embarrassing) :+(
BTW: instead of defining WinMainCRTStartup(), it's easier to use the
link option /ENTRY:mainCRTStartup.
Sorry for the rampant uncertainty,
Hay, at least it's better than calling me crazy for not using MSVC.
Actually, I am using VC++ 5.0 but I'd rather not.
Text item: External Message Header
The following mail header is for administrative use
and may be ignored unless there are problems.
***IF THERE ARE PROBLEMS SAVE THESE HEADERS***.
Content-Type: text/plain; charset="us-ascii"
Date: Wed, 26 Mar 1997 13:48:48 +0900
Subject: RE: Linking with .LIB files
Cc: "'GNU-Win32'" <email@example.com>
To: "'David W Palmer'" <David_W_Palmer@ccm.jf.intel.com>
From: Colin Peters <firstname.lastname@example.org>
Received: by gbird0 with Microsoft Mail
id <01BC39EC.6F6FE340@gbird0>; Wed, 26 Mar 1997 13:48:50 +0900
Received: from gbird0 ([22.214.171.124]) by bird.fu.is.saga-u.ac.jp (8.8.2/3.3W7-
bird) with SMTP id NAA19950; Wed, 26 Mar 1997 13:49:13 +0900 (JST)
Received: from bird.fu.is.saga-u.ac.jp (bird.fu.is.saga-u.ac.jp [126.96.36.199])
by ormail.intel.com (8.8.4/8.8.4) with ESMTP
id UAA05410 for <David_W_Palmer@ccm.jf.intel.com>; Tue, 25 Mar 1997 20:51
:50 -0800 (PST)
Received: from ormail.intel.com (ormail.intel.com [188.8.131.52]) by relay.jf.i
ntel.com (8.7.6/8.7.3) with ESMTP id UAA04374 for <David_W_Palmer@ccm.jf.intel.c
om>; Tue, 25 Mar 1997 20:52:03 -0800 (PST)
For help on using this list, send a message to
"email@example.com" with one line of text: "help".