0

Trying to build a project I get the error: "undefined reference to symbol 'XConvertSelection' ". I did a research and found that i should link to libX11.so.

I did add in CodeBlocks under Compiler Settings->Linker Settings->Add the directory "/usr/lib/i386-linux-gnu/libX11.so". However, error remains.

System: Ubuntu 14.04.1 LTS

Code::Blocks v.13.12

32 bit

I spent hours with google, still could not find a working solution. Thanks for your help!

The proposed solution linked, states:

"In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries."

That is exactly what i did (at least i think i did). However, it does not fix the error.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
NoMorePen
  • 43
  • 2
  • 8
  • `/usr/lib/i386-linux-gnu/libX11.so` How is this a _directory_ actually? Please read that Q&A and the given links thoroughly! You don't ever link against a `.so` file directly, but use an appropriate stub lib (`.a`) instead. – πάντα ῥεῖ May 16 '15 at 13:32

1 Answers1

0

"I did add in CodeBlocks under Compiler Settings->Linker Settings->Add the directory "/usr/lib/i386-linux-gnu/libX11.so". However, error remains."

/usr/lib/i386-linux-gnu/libX11.so isn't a directory. You want to specify the link library path to -L/usr/lib/i386-linux-gnu and link against X11 using the -lX11 option.

To add a search path for the linker use that Search Directories tab:

enter image description here

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
  • Thanks! I put the -lX11 option under "other linker options". Where do I specify the link library path? If I browse under "link libraries", I am asked for (*.a, *.so, *.lib, *.dylib, *.bundle) – NoMorePen May 16 '15 at 14:13
  • @NoMorePen As mentioned in my [answer to that duplicate I've linked before](http://stackoverflow.com/a/24715865/1413395) you provide it at the _`Search Directories->Linker`_ tab. I'll replicate that screenshot in my answer here. – πάντα ῥεῖ May 16 '15 at 14:20
  • I really appreciate your answer, but it did not work, error remains. I checked everything twice. Any other suggestions? – NoMorePen May 17 '15 at 09:40