Linking with .LIB files

David W Palmer David_W_Palmer@ccm.jf.intel.com
Wed Mar 26 17:32:00 GMT 1997


Text item: 


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


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 
>     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, 
     glaux.lib).
     
     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
     //f/pgming/OpenGL/simple$
     
     
     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.
     
     Dave

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-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'" <gnu-win32@cygnus.com>
To: "'David W Palmer'" <David_W_Palmer@ccm.jf.intel.com>
From: Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
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 ([133.49.23.250]) 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 [133.49.23.129])

          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 [134.134.248.3]) 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)
Return-Path: colin@bird.fu.is.saga-u.ac.jp
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list