first time compiling windows app with gcc

Colin Peters colin@bird.fu.is.saga-u.ac.jp
Wed Dec 17 17:43:00 GMT 1997


Given that your hello world program is *not* the example from Petzold's
Programming Windows 95 (which uses the multi-media API to play a sound
file) then it will probably compile if you do:

gcc -o hello.exe hello.c -mwindows

or

gcc -o hello.exe hello.c -luser32 -lgdi32 -Wl,--subsystem,windows

Which is roughly equivalent. Under Mingw32 0.1.4 you have to use -windows
instead of -mwindows (that should change in the next version BTW) for the
first type.

For multiple module applications use the -mwindows option at the linking
step (it's not necessary when just compiling).

Colin.

PS. If it *is* the example from Petzold then you need to add -lwinmm to
either of the above command lines, and you need the extra mmsystem.h file
that isn't currently included in the Win32 API headers from Cygnus (which
I can give you if necessary).

PPS. You might want to look at my (incomplete) tutorial on Win32
programming with GCC. Add gcc-tutor-contents.html to the URL in my
signature (either one).

-- Colin Peters -- colin at fu.is.saga-u.ac.jp
-- Saga University Dept. of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin
-- http://www.geocities.com/Tokyo/Towers/6162

-----Original Message-----
From: Kurt Hdusler <turtill@ihug.co.nz>
To: gnu-win32@cygnus.com <gnu-win32@cygnus.com>
Date: Wednesday, December 17, 1997 5:25 PM
Subject: first time compiling windows app with gcc


>hello, this question has already been asked by
carvalho@penelope.dss.inpe.br
>but it wasnt answered.
>
>how can I compile programs when i get error messages like undefined
>reference etc.  this is just a program using the windows api to pop up
one
>window and saw hello world.
>
>I have compiled it before under two other compilers and one of them I had
to
>use a option like    -lwin32  or something.  What is the equivalent
option
>with this compiler?
>
>gcc hello.c is all I have been using.
>
>Please answer, I would be very greatful.
>
>Thanks from Kurt
>
>
>-
>For help on using this list (especially unsubscribing), send a message to
>"gnu-win32-request@cygnus.com" with one line of text: "help".
>

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



More information about the Cygwin mailing list