GCC -R -L

cc test.c -L/home/linden -R/home/linden -lfruit

The -L/home/linden -R/home/linden options tell the linker in which directories to look for libraries at linktime and at runtime, respectively.

The compiler option -Lpathname is used to tell the linker a list of other directories in which to search for libraries that have been specified with the -l option. There are a couple of environment variables, LD_LIBRARY_PATH and LD_RUN_PATH, that can also be used to provide this information. Using these environment variables is now officially frowned on, for reasons of security, performance, and build/execute independence. Use the -Lpathname -Rpathname options at linktime instead.

Library Conventions Under Solaris 2.x
#include Filename Library Pathname Compiler Option to Use
/usr/lib/libm.so -lm
/usr/lib/libm.a -dn -lm
/usr/lib/libc.so linked in automatically
"/usr/openwin/include/X11.h" /usr/openwin/lib/libX11.so -L/usr/openwin/lib
-lX11
/usr/lib/libthread.so -lthread
/usr/ccs/lib/libcurses.a -lcurses
/usr/lib/libsocket.so -lsocket

 

 

你可能感兴趣的:(操作系统)