g++ : ld cannot find -lX11
Hey I have what I think would be an easy question:
This compiles : g++ someprog.cpp -L/usr/X11/lib -lX11 but this : g++ someprog.cpp -lX11 gives an error (ld cannot find -lX11) I thought if I put /usr/X11/lib/ into /etc/ld.so.conf then I wouldn't need to add the -L/usr/X11/lib/ all the time. What do I need to do to put that directory into the library search path? Thanks! p.s. I'm using Slackware 10.0 and the glibs have all been updated (using slackpkg) |
What happens when you don't add the -lX11? I've had makefiles fail with that, but if I remove the piece then it compiles fine.
|
Did you run 'ldconfig' after making changes in /etc/ld.so.conf ?
|
Hey, htanks for the help.
I didn't run ldconfig, but did after reading your post. It still give me the same error (cannot find -lX11) when I compile with : g++ somefile.cpp -lX11 And when I compile without any options like so : g++ somefile.cpp I get /tmp/ccAAgcot.o(.text+0x19): In function `main': : undefined reference to `XOpenDisplay' /tmp/ccAAgcot.o(.text+0x66): In function `main': : undefined reference to `XCloseDisplay' This is my ld.conf : usr/X11/ /usr/X11/lib/ /usr/local/lib /usr/X11R6/lib/ /usr/i486-slackware-linux/lib /opt/kde/lib /usr/lib/qt/lib /usr/lib/mozilla-1.6 /usr/lib/mozilla-1.4 |
Try remove :
usr/X11/ /usr/X11/lib/ from /etc/ld.so.conf and run ldconfig to see... (the official lib dir for X11 in slackware is : /usr/X11R6/lib) |
OK, removed the dirs from ld.so.conf, reran ldconfig as root and still getting the same things.
This is really strange. Maybe this will help: This is the exact error. Is it set up right? /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../../../i486-slackware-linux/bin/ld: cannot find -lX11 collect2: ld returned 1 exit status |
All times are GMT -5. The time now is 11:55 PM. |