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