This is the mail archive of the
mailing list for the Cygwin project.
success with --subsystem,windows and all that: the definitive answer
- To: <gnu-win32 at cygnus dot com>
- Subject: success with --subsystem,windows and all that: the definitive answer
- From: "Mark de Vos" <mdevos at cis dot co dot za>
- Date: Sun, 16 Aug 1998 12:07:53 +0200
Like so many newbies I've been struggling with the "hello windows"
programme. Now I've succeeded and I'd like to give this group some
feedback. Hopefully it will go into the archives and do somebody else some
- I've had problems with undefined references to various windows API tools.
I'd get stuff like "undefined reference to CreateWindow@48......
The problem here was that I was not linking to the correct libraries. After
searching the archives I linked to
-luser32 and to
-Then came the problem that the MSDOS window would show up each time I ran
the programme. The solution to that lay in using the -ssubsystem, windows
tag. Unfortunately, that command line didn't work and the compiler made
excuses about "unrecognised command", "invalid option" and even "no such
directory". I searched the archives and came up with some answers.
The -ssubsystem thingy is a TYPO! Wierd thing was that the same people
who recognised the typo, included their own typos in their errata messages.
Eventually I managed to iron the whole thing out: there were spaces in the
wrong places. Here is what I came up with( Where "l" is a lower-case "L")
gcc -o hello.exe hello.cpp -luser32 -lgdi32 -Wl,--subsystem,windows
Just to ensure that there is no confusion about the letters, here is the
upper-case version of the above command. comments will appear between
square brackets. I'm fussing about the spacing because that was what
GCC -O HELLO.EXE HELLO.CPP -LUSER32 [SINGLE SPACE] -LGDI32 [SINGLE
SPACE] -WL, [NOTE NO SPACE AT ALL] --SUBSYSTEM, [NOTE: NO SPACE AT ALL]
I still haven't solved the -mwindows problem which I posted in my last
letter to the list, but at least I can continue now.
Thanks a stack to everybody on the list. And a hint to others: search those
archives; they're very useful.
Mark de Vos
For help on using this list (especially unsubscribing), send a message to
"email@example.com" with one line of text: "help".