This is the mail archive of the cygwin@sourceware.cygnus.com 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: Linking problems.


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".


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