c++ - 警告 : extra tokens at end of#endif directive

标签 c++

我正在使用 VxWorks6.8 C++ 编译器编译一个相当大的项目。我收到以下警告

警告:#endif 指令末尾的额外标记

#ifndef _OM_NO_IOSTREAM
#ifdef WIN32
#ifndef USE_IOSTREAM
#define USE_IOSTREAM
#endif USE_IOSTREAM
#endif WIN32

我收到了很多这样的警告。

  1. Why i am getting these warnings and from C++ standard point of view?
  2. What is the good reason why compiler is warning for this?
  3. What is the best way to fix this?

谢谢

最佳答案

应该是:

#endif // USE_IOSTREAM
#endif // WIN32

endif 不接受任何参数。放置此类评论只是为了便于阅读

编辑:

你错过了最后关闭 #endif//_OM_NO_IOSTREAM

关于c++ - 警告 : extra tokens at end of#endif directive,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7467931/

相关文章:

c++ - 无注册 COM 进程外 EXE

c++ - 两个数之间的质数

c++ - 可以做些什么来优化离开方法和清空局部变量堆栈所花费的时间?

c++ - C++中的异常被捕获后找出源头?

c++ - 检查模块是否与多线程 dll (/MD) 库链接

c++ - clang++ 默认参数或配置文件

android - 在 Android NDK 中为 AccountPicker 接收 onActivityResult

c++ - 使用 cin.ignore 和 cin.clear C++ 时的奇怪行为

c++ - 如何告诉 Cppdepend 一个目录有多个本地拷贝

c++ - 在 if 语句中输入带数字的字母