现在的位置: 首页 > 综合 > 正文

gcc生成和链接库的方法总结

2012年11月09日 ⁄ 综合 ⁄ 共 249字 ⁄ 字号 评论关闭

gcc -o test test.c -Wl,-Map,test.map

gcc shellex.c ../src/csapp.c -I../include/ -lpthread

编成共享库.so

gcc -shared -fPIC -o libvector.so addvec.c multvec.c

gcc -rdynamic -O2 -o p3 dll.c -ldl

静态库动态库混合使用时要加特殊指令:
gcc -g -lstdc++ -g -WI,-dynamic -L. -lmy -WI,-static -L. -lmy -o test.exe main.cc

抱歉!评论已关闭.