This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


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

undefined reference to "function name"


Hello all,
Since i have installed RedHat 6.2 i have this problem.
I am trying to compile a program i get errors about "undefined reference
to"
for instance :
i tried to compile the following program
#include <X11/extensions/XTest.h>
#include <X11/keysym.h>

int main()
    {
    Display* disp = XOpenDisplay( NULL );
    if( disp == NULL )
        return 1;
    XTestFakeKeyEvent( disp, XKeysymToKeycode( disp, XK_Num_Lock ),
True, CurrentTime );
    XTestFakeKeyEvent( disp, XKeysymToKeycode( disp, XK_Num_Lock ),
False, CurrentTime );
    XCloseDisplay( disp );
    return 0;
    }
and i got
gcc -o ./numclocks.e ./numclocks.o
./numclocks.o:
 In function `main':
./numclocks.o(.text+0x9): undefined reference to `XOpenDisplay'
./numclocks.o(.text+0x30): undefined reference to `XKeysymToKeycode'
./numclocks.o(.text+0x42): undefined reference to `XTestFakeKeyEvent'
./numclocks.o(.text+0x57): undefined reference to `XKeysymToKeycode'
./numclocks.o(.text+0x69): undefined reference to `XTestFakeKeyEvent'
./numclocks.o(.text+0x75): undefined reference to `XCloseDisplay'
collect2: ld returned 1 exit status

the same errors i got when i tried to compile the tcsysmon-1.42 (with
different functions of course).
I have the XTest.h and keysym.h headers.
I thought that may be a problem with my libs so i check my
/etc/ld.so.conf , i have these lines :
/usr/X11R6/lib
/usr/kerberos/lib
/usr/i486-linux-libc5/lib
i read the manual of ld and ldconfig but i didn't find any help.

So, does anyone know anything about my problem?
Could someone give me some assistance in order to solve this problem?

Yours,
Pavlos

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I love having the feeling of being in control
while i have the sensation of speed

The surfer of life
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



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