This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


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

success with --subsystem,windows and all that: the definitive answer


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
mdevos@cis.co.za

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


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