g++编译

整理一波g++编译参数

-c: 仅编译源文件
-o: 指定输出文件内容
-g: 产生调试信息
-l: 和特定library链接

 

g++ test.cpp

生成可执行文件a.out

 

g++ test.cpp -o test

生成可执行文件test

 

g++ -c test.cpp

生成test.o

 

g++ -g -c test.cpp

生成带调试信息的test.o

 

g++ test.o other.o -o test

链接目标文件,生成可执行文件test

 

 

参考资料:

gcc命令

GCC Command Options

posted @ 2017-09-23 19:52  Sawyer Ford  阅读(252)  评论(0编辑  收藏  举报