main.cpp
#include <iostream>
using namespace std;
int main()
{
#ifdef PRINT
cout << __LINE__ << endl;
#endif
cout << __LINE__ << endl;
return 0;
}
终端命令行:g++ main.cpp -D PRINT。
通过实验发现,-D+宏定义,中间加不加空格,似乎都可以的。
自己老是忘记,写个博客记录下来。
转载请注明原文地址: https://ju.6miu.com/read-1781.html