EGCS Mingw32 1.0.2 - compilation problem - undefined referenceto a function

Øystein Johansen oeysteij@online.no
Wed Aug 5 13:26:00 GMT 1998


Hi!

try:

bash$ gcc w.c -o w.exe -lgdi32 -luser32

The error messages you are attaching to your mail, is error messages from
the linker (not the compiler). BTW there are some errors in the code as
well. when you type #include<windows.h> in the top of your code, this is
just a message to preprosessor to include declarations of the library file.
After compiling, you need to link the library code. This is done with
-lgdi32 and -luser32.
You can also do this in two steps:

bash$ gcc -c w.c

This will just compile your source, and make the object file w.o

bash$ gcc -o w.exe w.o -lgdi32 -luser32 

This will link the files together to make an executable file.

Regs,
Øystein Johansen

BTW: I think you need to edit yuor code a bit aswell
     -- and, you do not need ; after }

----------
> From: Inquisitor Nikodemus <inquisit@friko6.onet.pl>
> To: egcs@cygnus.com
> Subject: EGCS Mingw32 1.0.2 - compilation problem - undefined referenceto
a function
> Date: 4. august 1998 19:00
> 
> hey!
> 
> I wrote a small win95 program,that simply does nothing.I wanted to
compile
> it with egcs (mingw32 native,1.0.2) with command " gcc w.c -o w.exe ".
> 
> This is the program source code :
> 
[snip code and error messages]

> That's strange for me. The windows.h is included correctly,as there is no
> error msg for e.g. WNDCLASSEX struct.
> What am i to do then ?
> 
> and second question : is there gdb for egcs,and where can i find it?
> 
> 
> 
> /greetz
> Nikki (aka Inquisitor Nikodemus)



More information about the Gcc mailing list