linux 编译C++

转载请注明来源:https://www.cnblogs.com/hookjc/

makefile文件内容:

main:main.o fun1.o fun2.o

                 g++ -o main  main.o fun1.o fun2.o

fun1.o:fun1.cpp fun1.h

                 g++ -c fun1.cpp

fun2.o:fun2.cpp fun2.h

                  g++ -c fun2.cpp

clean:

                   rm -rf *.o

或者:

../bin/main:main.cpp

                   g++ -o ../bin/main -g main.cpp

//生成到上一层的bin文件夹下

clean:

                   rm -rf *.o

来源:python脚本自动迁移

posted @ 2020-06-29 09:48  jiangcheng_15  阅读(110)  评论(0编辑  收藏  举报