Windows 下使用makefile
写了一个简单的demo,测试使用:
// main.cpp
#include <iostream>
using namespace std;
int main() {
cout << "Hello world" << endl;
return 0;
}
// Makefile
target = test.exe
srcs = main.cpp
$(target) : $(srcs)
cl -o [email protected] $^
在命令行执行nmake 提示:
不认识 $^ ?修改Makefile如下:
// Makefile
target = test.exe
srcs = main.cpp
$(target) : $(srcs)
cl -o [email protected] $**
执行nmake,结果如下: