-
在程序文件夹里新建一个文件
-
named “makefile” or “Makefile”
-
write down these codes:
program_name: 你想创建的object files name tab+command(link object files to create an executable file named with program name) 1st_object_file_name: name.cpp tab+command(g++ -c name.cpp) 2nd_object_file_name: name2.cpp tab+command(g++ -c name2.cpp) ... clean: tab+rm *.o program_name ...
-
实例:
对于一个有main.cpp, IntList.cpp, IntList.h三个文件的名为P5的简单程序:P5: main.o IntList.o g++ main.o IntList.o -o P5
如何生成一个简单的 makefile 文件
最新推荐文章于 2024-02-26 14:53:14 发布