Subject: success with --subsystem,windows and all that: the definitive answer
From: [email-masked] (Mark de Vos)

16 Aug 1998 14:40:57 -0700
Message-ID: <01bdc8fd$bc0a13a0$LocalHost.cygnus.gnu-win32@mark>
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
To: <[email-masked]>

Hi

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

- 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
    -lgdi32

-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
snookered me.

GCC -O HELLO.EXE HELLO.CPP -LUSER32 [SINGLE SPACE] -LGDI32 [SINGLE
SPACE] -WL, [NOTE NO SPACE AT ALL] --SUBSYSTEM, [NOTE: NO SPACE AT ALL]
WINDOWS.

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
freelance writer
[email-masked]

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".