日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

makefile入门

發(fā)布時間:2025/6/15 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 makefile入门 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

? ? ? ? ? ? ? ? ? linux下編程,makefile的重要性不用多說,網(wǎng)上一大堆,今天簡單的實戰(zhàn)一下。

[xxx@localhost test]$ ls makefile test1.cpp test2.cpp [xxx@localhost test]$ cat test1.cpp #include<stdio.h>int main() {printf("this is test1\n");return 0; } [xxx@localhost test]$ cat test2.cpp #include<stdio.h>int main() {printf("this is test2\n");return 0; } [xxx@localhost test]$ cat makefile all:test1 test2test1:test1.o g++ test1.o -o test1 test2:test2.og++ test2.o -o test2test1.o:test1.cppg++ -c test1.cpp -o test1.o test2.o:test2.cppg++ -c test2.cpp -o test2.oclean:rm -fr *.o [xxx@localhost test]$

執(zhí)行:

[xxx@localhost test]$ make g++ -c test1.cpp -o test1.o g++ test1.o -o test1 g++ -c test2.cpp -o test2.o g++ test2.o -o test2 [xxx@localhost test]$ ls makefile test1 test1.cpp test1.o test2 test2.cpp test2.o [xxx@localhost test]$ ./test1 this is test1 [mapan@localhost test]$ ./test2 this is test2 [xxx@localhost test]$ all作用:makefile會把第一個目標(biāo)作為默認(rèn),all可以指定多個目標(biāo)

test.o:test.cpp這表示依賴關(guān)系,標(biāo)明生成test.o需要test.cpp

[mapan@localhost test]$ make clean rm -fr *.o make clean清除所有.o文件



總結(jié)

以上是生活随笔為你收集整理的makefile入门的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。