2

While compiling this file

g++ -m64 -Wl,-O1 -o qjoypad 
    axis.o axis_edit.o axisw.o button.o button_edit.o buttonw.o event.o flash.o icon.o joypad.o joypadw.o joyslider.o keycode.o layout.o layout_edit.o main.o quickset.o getkey.o moc_axis.o moc_axis_edit.o moc_button.o moc_button_edit.o moc_flash.o moc_icon.o moc_joypad.o moc_joypadw.o moc_keycode.o moc_layout.o moc_getkey.o moc_layout_edit.o    
    -L/usr/lib/x86_64-linux-gnu -lXtst -lQtGui -lQtCore -lpthread -lXtst

I get the following error:

/usr/bin/ld: keycode.o: undefined reference to symbol 'XKeycodeToKeysym'
//usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line

However, the symbol is just a global variable:

$ readelf -s /usr/lib/x86_64-linux-gnu/libX11.so.6 | grep XKeycode
     259: 000000000008a000   646 FUNC    GLOBAL DEFAULT   11 XKeycodeToKeysym
    1308: 0000000000029830    73 FUNC    GLOBAL DEFAULT   11 _XKeycodeToKeysym

I've found this question, but the user was just linking in the wrong place, or this question, which is related to pkgconfig. As far as I can see, my build command should be correct.

Mike Kinghan
  • 55,740
  • 12
  • 153
  • 182
BlueMoon93
  • 2,910
  • 22
  • 39

2 Answers2

1

Found the issue. I had to specifically include -lX11, which the .configure command didn't do, for some reason.

g++ -m64 -Wl,-O1 -o qjoypad 
    axis.o axis_edit.o axisw.o button.o button_edit.o buttonw.o event.o flash.o icon.o joypad.o joypadw.o joyslider.o keycode.o layout.o layout_edit.o main.o quickset.o getkey.o moc_axis.o moc_axis_edit.o moc_button.o moc_button_edit.o moc_flash.o moc_icon.o moc_joypad.o moc_joypadw.o moc_keycode.o moc_layout.o moc_getkey.o moc_layout_edit.o    
    -L/usr/lib/x86_64-linux-gnu -lXtst -lQtGui -lQtCore -lpthread -lX11
BlueMoon93
  • 2,910
  • 22
  • 39
0

Look in the Makefile for the bit that says

LIBS = -lfoo -lbar ...

and add it there.

sc0ttj
  • 85
  • 1
  • 11