ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The problem is that when I compile I get this error:
Code:
g++ -Wl,-rpath,/usr/lib/qt/lib -o connectMonitor main.o xkeylock.o mainw.o moc_xkeylock.o moc_mainw.o -L/usr/lib/qt/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11-lm
xkeylock.o(.text+0x547): In function `XKeyLock::toggleNumLock()':
: undefined reference to `XTestFakeKeyEvent'
xkeylock.o(.text+0x56a): In function `XKeyLock::toggleNumLock()':
: undefined reference to `XTestFakeKeyEvent'
xkeylock.o(.text+0x5a7): In function `XKeyLock::toggleCapsLock()':
: undefined reference to `XTestFakeKeyEvent'
xkeylock.o(.text+0x5ca): In function `XKeyLock::toggleCapsLock()':
: undefined reference to `XTestFakeKeyEvent'
xkeylock.o(.text+0x607): In function `XKeyLock::toggleScrollLock()':
: undefined reference to `XTestFakeKeyEvent'
xkeylock.o(.text+0x62a): more undefined references to `XTestFakeKeyEvent' follow
collect2: ld returned 1 exit status
make: *** [connectMonitor] Error 1
But as it turns out that `XTestFakeKeyEvent' is defined in X11/extensions/XTest.h, and this file is includede and the path is correct. So why is it acting as if I did not add the concerned header file?
ld is the linker; when it gives you "undefined reference" it means you forgot to link something, not that you forgot a header. Some grepping suggests the missing culprit is libXtst, whatever that is.
Distribution: OpenSuse 10.2, Slackware 11, Solaris 10
Posts: 415
Original Poster
Rep:
Quote:
ld is the linker; when it gives you "undefined reference" it means you forgot to link something, not that you forgot a header
I 'copied' this file from KeybLED program, to control Keyboard LEDS, well, I checked for any external references but found that it was totally self-contained, so I copied it to my project and started using it until this happened.
Now the linker thing is a bit curious, because I compiled KeybLED too, and that compiled without any problems
the xkeylock.moc.lo file, which is for the linker is the exact same KeybLED has, but only in mine it gives an error?
Originally posted by irfanhab I 'copied' this file from KeybLED program, to control Keyboard LEDS, well, I checked for any external references but found that it was totally self-contained, so I copied it to my project and started using it until this happened.
Now the linker thing is a bit curious, because I compiled KeybLED too, and that compiled without any problems
the xkeylock.moc.lo file, which is for the linker is the exact same KeybLED has, but only in mine it gives an error?
I think aluser is right, error message meaning that you missed to link a library. You have a binary of KeybLED? You can
get it's dependencies with ldd (ldd <KeybLED binary>), it's one of the files dumped then that you should add to the list of
object files in your makefile.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.