From: khan@xraylith.wisc.edu (Mumit Khan)
Subject: Re: Linking problems.
24 Jul 1998 09:30:38 -0700
Message-ID: <Pine.SUN.3.93.980723223737.8631D-100000.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <35B757CB.D54A10AD@Brown.Edu>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: Aaron Schweiger <Aaron_Schweiger@Brown.Edu>
Cc: gnu-win32@cygnus.com

On Thu, 23 Jul 1998, Aaron Schweiger wrote:

> I am trying to link the mgui graphics library under gnu-win32, however,
> I keep getting linking errors:
> 
> e:\MINGW32\LIB\GCC-LIB\i386-mingw32\egcs-2.90.27\../../..\libmguiw.a(mguiinit.o)(.text+0x2ad):mguiinit.c:
> undefined reference to `MessageBoxA'
> e:\MINGW32\LIB\GCC-LIB\i386-mingw32\egcs-2.90.27\../../..\libmguiw.a(mguiinit.o)(.text+0x904):mguiinit.c:
> undefined reference to `GetModuleFileNameA'
> 
> Quite clearly, the library I am linking is forgetting the @16 needed at
> the end of the function name.  Can I resolve this problem?
> 

Hmmm ... looks like something is redefining STDCALL somewhere, and that's
the root of your problem. In Windows32/ASCIIFunctions.h, MessageBoxA is
declared as the following:
  
  int
  STDCALL
  MessageBoxA (
    /* parameters here
    /* parameters here );

You must be including some header *before* windows.h that's redefining
STDCALL to *nothing* and hence gcc doesn't know that it should append
the @16 to the name of the function and also generate the right code
for pascal-style calling convention required.

Check for messages when compiling and see if there are any messages like:

  ......[file name]: ##: warning: STDCALL redefined.
  ......[ another ]: ##: warning: STDCALL first defined here.

That should get you started. Also, make sure that you've not changed the
GCC specs files.

fyi, STDCALL is defined to __stdcall__((attribute)) in <Windows32/Base.h> 
iff i386 is defined by pre-processor (which is should be in your case).

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
