This is the mail archive of the 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]

Re[2]: Linking with .LIB files

Text item: 

     For those who are watching: Colin Peter's text is left justified, mine is 

David W Palmer[] wrote:
>     So, I have a simple program which uses OpenGL and I link with the 
>     following:
>     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.
     //f/pgming/OpenGL/simple$ make
     link simple.o crt0.o libuser32.a glu32.lib opengl32.lib libgdi32.a 
     /subsystem:windows /machine:i386
     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.


Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Date: Wed, 26 Mar 1997 13:48:48 +0900
Subject: RE: Linking with .LIB files
Cc: "'GNU-Win32'" <>
To: "'David W Palmer'" <>
From: Colin Peters <>
Message-ID: <01BC39EC.6F6FE340@gbird0>
Received: by gbird0 with Microsoft Mail
     id <01BC39EC.6F6FE340@gbird0>; Wed, 26 Mar 1997 13:48:50 +0900
Received: from gbird0 ([]) by (8.8.2/3.3W7-
bird) with SMTP id NAA19950; Wed, 26 Mar 1997 13:49:13 +0900 (JST)
Received: from ( [])

          by (8.8.4/8.8.4) with ESMTP
       id UAA05410 for <>; Tue, 25 Mar 1997 20:51
:50 -0800 (PST)
Received: from ( []) by relay.jf.i (8.7.6/8.7.3) with ESMTP id UAA04374 for <
om>; Tue, 25 Mar 1997 20:52:03 -0800 (PST)
For help on using this list, send a message to
"" with one line of text: "help".

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