Friday, November 04, 2005

Linux command :
1. set environment variable:
export PATH=$PATH:/share, thus, "env" can list all the variables. and if want to unset it, use
unset PATH.
2. "source" : open a script and execute it in current shell.
3. "ldconfig" : update dynamic linker library which is under the /usr/lib and /lib.
Add another library path:
1). edit /etc/ld.so.conf, add directory in the file, then run "ldconfig".
2). on the gcc command line, -L specify the directory, -llibrary specify the library which has a prefix "lib",postfix "so". eg: gcc -o out prog.c -L/usr/xx -lsharelib ,which means that libsharelib.so under the /usr/xx dir.
after u compile the program, you should set the LD_LIBRARY_PATH env variable.
"ldconfig -p" can list the path cache.
4. "gcc -v dummy.c" can list the detailed information about preprocessor, compilation, assembly stages and gcc's included paths and their order.
5. "gcc -o out mypro.c requiredlib.a " produce a static link with requiredlib.a

0 Comments:

Post a Comment

<< Home