* Newbie Compilation Question
@ 1997-10-31 17:59 GBradfor
1997-11-01 8:53 ` Fernandes, Hilton
0 siblings, 1 reply; 2+ messages in thread
From: GBradfor @ 1997-10-31 17:59 UTC (permalink / raw)
To: gnu-win32
Yet again I must apologize for the newbie nature of this question, but
perusing the archives has revealed no answer.
I am compiling a very simple program for reading keystrokes.
Specifically, I wish to use GetKeyState(). I have included windows.h
in my program file, and I have linked with both user32 and glaux (the
latter of which I believe may be superfluous.). The reason I have not
used the -mwindows option is that I am not trying to write a GUI-based
program, just to get access to GetKeyState. In any case, I keep
getting the following two error messages:
C:\WINDOWS\TEMP\cc0010001.o(.text+0x3a):keystate.c: undefined
reference to GetKeyState@4
C:\WINDOWS\TEMP\cc0010001.0(.text+0x6d):keystate.c: undefined
reference to GetKeyState@4
And, naturally, the link fails. I have checked the libraries using nm
and have found that user32 and glaux appear to be where GetKeyState@4
is defined. Apparently, I'm wrong.
Any suggestions?
/s/
Pat Bradford
Respond to:
gbradfor@redstone.army.mil
AND/OR
p_n_brad@traveller.com (With the weekend coming up, this one is
preferable)
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Newbie Compilation Question
1997-10-31 17:59 Newbie Compilation Question GBradfor
@ 1997-11-01 8:53 ` Fernandes, Hilton
0 siblings, 0 replies; 2+ messages in thread
From: Fernandes, Hilton @ 1997-11-01 8:53 UTC (permalink / raw)
To: GBradfor, p_n_brad, gnu-win32; +Cc: Fernandes, Hilton
On 31 Oct 97 at 15:25, GBradfor <GBradfor@fhssmtp.redstone.army.mil> wrote:
> I am compiling a very simple program for reading keystrokes.
> Specifically, I wish to use GetKeyState(). I have included windows.h
> in my program file, and I have linked with both user32 and glaux (the
> latter of which I believe may be superfluous.). The reason I have not
> used the -mwindows option is that I am not trying to write a GUI-based
> program, just to get access to GetKeyState. In any case, I keep
> getting the following two error messages:
>
> C:\WINDOWS\TEMP\cc0010001.o(.text+0x3a):keystate.c: undefined
> reference to GetKeyState@4
> C:\WINDOWS\TEMP\cc0010001.0(.text+0x6d):keystate.c: undefined
> reference to GetKeyState@4
>
Hi!
This is a (non-direct :-) consequence of what was commented in a previous
message in this list: when you link twice to the same library, you sure have
link problems, due to the messing of internal ld tables.
You don't link twice to the same library, but to two different libraries that
have definitions of the same function.
I was able to link and run normally a program that used GetKeyState(). I used
only libuser32.a. Here are my command lines:
gcc -c KeyState.c
gcc KeyState.o -o KeyState.exe -luser32
Best regards,
++Hilton
P.S.: The message was from Colin Peters <colin@bird.fu.is.saga-u.ac.jp>, its
subject line was "RE: Compiler, and was sent Thu, 30 Oct 1997.
----
Hilton Fernandes
hfernandes@geocities.com
http://www.geocities.com/SiliconValley/Lakes/5657
URLs and help on C++ programming and Object-Oriented Design
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1997-11-01 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-31 17:59 Newbie Compilation Question GBradfor
1997-11-01 8:53 ` Fernandes, Hilton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).