【发布时间】:2012-02-19 16:04:35
【问题描述】:
错误:
cxx.cpp:5:13: error: missing binary operator before token "("
cxx.cpp:7:15: error: missing binary operator before token "("
代码:
#if definied(_WIN32) || definied(_WIN64) || definied(__WIN32__)
const char * PORT = "COM1";
#elif definied(__linux) || definied(__linux__) || definied(linux)
const char * PORT = "dev/ttyS1";
#else
const char * PORT = NULL;
#endif
问题:
- 编译器正在等待新的
defined()调用? - 它可以检测到任何 linux(及其变体)或 windows 版本吗?
提前致谢。
【问题讨论】:
-
由于这不可能是您的实际代码(“定义”显然是复制粘贴的错字),因此很难回答。
-
您在整个预处理器代码示例中都拼错了
defined。
标签: c++ g++ preprocessor-directive