有人可以解释这个现象吗?
#include <iostream>
int main() {}
Run Code Online (Sandbox Code Playgroud)
并编译它,gaves:
g++ main.cpp -Dn=1
<command-line>:0:3: error: expected unqualified-id before numeric constant
Run Code Online (Sandbox Code Playgroud)
这是完整的视频.我想知道这些储备物品的完整清单,以及它们是什么.我的环境是cygwin:
g++ --version
g++ (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Run Code Online (Sandbox Code Playgroud)
-Dn=1被定义n为一个宏之前iostream被包括在内,这意味着它是重新定义的每次发生n在 iostream为1时,打破了很多东西.
要修复它,请选择一个不同的宏名称,或者#define在include之后移动到文件内部.