This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


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

Re: problem with egcs-2.91.66 on Win32


In article <cxIW3.26$as2.586@news.iol.ie>,
Gothmog <gothmog2000@hotmail.com> wrote:
>I'm having a problem: I cannot call basic Win32 functions using egcs
>compiler (mingw32):
>
>#include <windows.h>
>
>int main()
>{
>  MessageBoxA(0, "Testing Windows!", "Test", MB_OK | MB_ICONINFORMATION);
>  return 0;
>}
>
>This comes up with an error:
>c:\tmp\ccHGdggb.o(.text+0x2f):test.cc: undefined reference to
>`MessageBoxA@16'

Older versions of gcc on windows32 (before egcs-1.1.2) didn't link
with libuser32.a by default, and that's what you're seeing.

Solution:
  1. upgrade to gcc-2.95.2
  2. Link with -luser32 explicitly.
     
     $ gcc -o foo foo.c -luser32

There have two binary releases (gcc-2.95 and gcc-2.95.2), and I do 
recommend that you upgrade. 

http://www.xraylith.wisc.edu/~khan/software/gnu-win32/

Regards,
Mumit


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