LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-23-2004, 03:04 AM   #1
infinitycool
LQ Newbie
 
Registered: Apr 2004
Posts: 5

Rep: Reputation: 0
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)
 
Old 09-23-2004, 03:27 AM   #2
realjustin
Member
 
Registered: Aug 2004
Location: /dev/null
Distribution: Slack 10, Debian
Posts: 99

Rep: Reputation: 15
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.
 
Old 09-23-2004, 06:27 AM   #3
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
Did you run 'ldconfig' after making changes in /etc/ld.so.conf ?
 
Old 09-23-2004, 02:43 PM   #4
infinitycool
LQ Newbie
 
Registered: Apr 2004
Posts: 5

Original Poster
Rep: Reputation: 0
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
 
Old 09-23-2004, 02:58 PM   #5
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
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)
 
Old 09-23-2004, 04:48 PM   #6
infinitycool
LQ Newbie
 
Registered: Apr 2004
Posts: 5

Original Poster
Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can`t find C-compiler in Debian ,or at least can`t find one that can make executables hemmelig Linux - Software 4 05-26-2008 03:07 AM
can not find lX11 problem lljxh Linux - Software 4 08-27-2003 12:58 AM
Linker problem -lX11 Flibble Linux - Software 1 06-16-2003 01:39 AM
ld -lX11 can not find -lX11 Alexop Linux - Newbie 1 08-18-2002 07:01 PM
ld -lX11 can not find -lX11 Alexop Linux - General 1 08-18-2002 06:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration