You are not logged in.

#1 2004-03-17 20:32:40

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 711
Website

GCC Library Path

How can I add /usr/lib/X11R6 to my library path for GCC so I dont need to add
-L /usr/lib/X11R6 to every compilation?


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#2 2004-03-18 01:08:02

farphel
Forum Fellow
From: New Hampshire - USA
Registered: 2003-09-18
Posts: 250
Website

Re: GCC Library Path

Add the paths to /etc/ld.so.conf and the run 'ldconfig' to regenerate the search path for the linker.  Your other option is to add the path(s) to the LD_LIBRARY_PATH environment variable.


Follow the link below, sign up, and accept one promotional offer.  If I can get five suckers (err... friends) to do this, I'll get a free iPod.  Then you too can try to get a free iPod. Thanks! http://www.freeiPods.com/?r=11363142

Offline

#3 2004-03-18 20:29:53

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 711
Website

Re: GCC Library Path

I did that... and it just says:  cannot find -lX11


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#4 2004-03-19 00:30:37

farphel
Forum Fellow
From: New Hampshire - USA
Registered: 2003-09-18
Posts: 250
Website

Re: GCC Library Path

Are you sure you specified the correct path?  In your first post, you do not have it specified correctly.  Here's my /etc/ld.so.conf:

#
# /etc/ld.so.conf
#

/usr/X11R6/lib
/opt/mozilla/lib/mozilla-1.6
/opt/gnome/lib
# End of file

After you make sure the paths are correct, re-run 'ldconfig' as root.


Follow the link below, sign up, and accept one promotional offer.  If I can get five suckers (err... friends) to do this, I'll get a free iPod.  Then you too can try to get a free iPod. Thanks! http://www.freeiPods.com/?r=11363142

Offline

#5 2004-03-19 01:32:42

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 711
Website

Re: GCC Library Path

#
# /etc/ld.so.conf
#

/usr/X11R6/lib
/opt/qt/lib
/opt/gnome/lib

# End of file
g++ main.cpp -lX11

brings this...

/usr/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status

What the heck!


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#6 2004-03-19 01:47:51

farphel
Forum Fellow
From: New Hampshire - USA
Registered: 2003-09-18
Posts: 250
Website

Re: GCC Library Path

What do you get when you run this?

root@i8k$ ldconfig -v | grep X11

Here's what I get:

/usr/X11R6/lib:
        libX11.so.6 -> libX11.so.6.2

Follow the link below, sign up, and accept one promotional offer.  If I can get five suckers (err... friends) to do this, I'll get a free iPod.  Then you too can try to get a free iPod. Thanks! http://www.freeiPods.com/?r=11363142

Offline

#7 2004-03-19 02:06:54

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 711
Website

Re: GCC Library Path

Mine is exactly the same!


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#8 2004-03-19 08:21:15

DanEE
Member
From: Fribourg, Switzerland
Registered: 2003-07-10
Posts: 43

Re: GCC Library Path

I have the same problem. Although I have the line /usr/X11R6/lib in ld.so.conf since a long time.

Offline

#9 2004-03-19 10:41:25

andy
Member
From: Germany
Registered: 2002-10-11
Posts: 374

Re: GCC Library Path

Careful, everybody !

/etc/ld.so.conf only configures the RUN-TIME search paths, not the LINK-TIME paths !

There is no universal method to include paths for link/compile time. You can try to set the enviornment variable LFLAGS, but that only works (sometimes) with make.

Offline

#10 2009-05-10 13:59:03

Nezmer
Member
Registered: 2008-10-24
Posts: 559
Website

Re: GCC Library Path

jkbs wrote:

.......  . See gcc(1).

See the date of the thread .


English is not my native language .

Offline

Board footer

Powered by FluxBB