Subject: Re: more information on my problem
From: [email-masked] (Colin Peters)

17 Dec 1997 20:02:07 -0800
Message-ID: <[email-masked]>
Reply-To: "Colin Peters" <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
To: "=?iso-8859-1?Q?Kurt_H=E4usler?=" <[email-masked]>
Cc: "GNU-Win32" <[email-masked]>

From: Kurt H?sler <[email-masked]>
To: [email-masked] <[email-masked]>
Date: Thursday, December 18, 1997 12:06 PM
Subject: more information on my problem

>One person suggested explicitly linking libraries in this manner :
>
>gcc -o hello.exe hello.c -lwin32 -Wl,-subsystem,windows
>
>But it says Wl,-subsystem,windows is an undefined flag.  (I cant find it
>anywhere on the docs either)
>
>Someone said adding -lkernal32 -luser32 but the compiler says:
>
>file -lkernal32 not found which looks as though its not recognizing
the -l
>flag!!

You are the victim of multiple typos, as well as some bad (or misdirected)
advice. The first person was missing a dash in the option (should
be -Wl,--subsystem,windows) and also telling you to link a library that
doesn't exist (-lwin32 will not work). The second person meant -lkernel32,
but that's a bad idea too, because kernel32 is linked automatically and
linking it twice can cause problems.

It is normal, by the way, for the linker to report not being able to find
the "file" -lfoo when really it can't find the library libfoo.a... just
one of the quirks of the GNU linker.

Here is a command line that works (I know it works because I cut and
pasted from the window where I just ran it):

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

The command line above tells the linker to use a (yes, not officially
documented yet, though it is mentioned in the FAQ at Cygnus) subsystem
option to make a GUI application. It also tells it to link two extra
libraries libuser32.a (user interface, window management and such) and
libgdi32.a (graphics device interface) (BTW, I believe that is also
mentioned in the FAQ at Cygnus).

There is also an option -mwindows which sets -Wl,--subsystem,windows and
links those libraries, along with a few others. So

gcc -o hellowin.exe hellowin.c -mwindows

Should also work (and I think that is also mentioned in the FAQ). Feel
free to ask if you have more problems.

Good luck,
Colin.

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

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