Linux 库的使用

Linux 库的使用

-I头文件的路径
-L动态库的路径

  命名 使用
静态库 lib名字.a 静态库路径/lib名字.a
动态库 lib名字.so -L动态库路径 -l名字

编译

#静态编译
# g++ -o test test.cpp -std=c++11 /usr/local/lib/libboost_regex.a

#ls
    -rwxrwxr-x 1 diaoss diaoss 334256 8月  23 09:49 test*



#动态编译
# g++ -o test test.cpp -std=c++11 -L/usr/local/lib -lboost_regex

#ls
    -rwxrwxr-x 1 diaoss diaoss 77384 8月  23 09:54 test*
原文地址:https://www.cnblogs.com/diaoss/p/11583320.html