Subject: Re: Linking problems.
From: [email-masked] (Mumit Khan)

24 Jul 1998 09:30:38 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: Aaron Schweiger <[email-masked]>
Cc: [email-masked]

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
"[email-masked]" with one line of text: "help".