Results 1 to 3 of 3
Hi,
How can i make gcc linker to use static library to link from a predefined library path where i have .so and .a libraries of same name, like libx.so ...
- 01-04-2008 #1Just Joined!
- Join Date
- Jan 2008
- Posts
- 2
static library linking
Hi,
How can i make gcc linker to use static library to link from a predefined library path where i have .so and .a libraries of same name, like libx.so and libx.a ???
Actually, if i give " gcc < myprogram.c > -lx " , by default linking is done with .so library ie libx.so. So, what i mean is i dont want to mention entire path of my .a library which is at predefined library path, where a .so library is present too with same name.
Thanks in advance
Barz
- 01-04-2008 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Have a read of this:
http://www.faqs.org/docs/Linux-HOWTO...ary-HOWTO.html
Regards
- 01-07-2008 #3Just Joined!
- Join Date
- Jan 2007
- Posts
- 9
surround the libraries you wish to link statically with -static and -dynamic
Ex:
gcc -o foo foo.o bar.o -L/s/X11R6.3-1/lib -R/s/X11R6.3-1/lib \
-static -lX11 -lXext -dynamic -lXt -lSM -lsocket -lnsl


Reply With Quote