c++ - "unexpected in macro definition"

标签 c++ macros

我写了

#ifndef Header1.h
#define Header1.h

class Complex
{
   [...]
};

#endif

在我的项目 (Visual Studio 2010) 中出现错误 C2008:“.” : 在宏定义中意外。我不明白“Header1.h”有什么问题或如何解决它。

最佳答案

不要使用 .使用 _ 代替

#ifndef HEADER1_H
#define HEADER1_H

class Complex
{
   [...]
};

#endif

关于c++ - "unexpected in macro definition",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19797740/

相关文章:

c++ - 如何在构造函数上正确使用 std::enable_if

c++ - 在 QTextEdit 中放置图像的几种方法

macros - 显示从 lisp 宏生成的代码

c++ - 如何在运行时生成函数?

macros - 如何在 C 预处理器中生成唯一值?

c++ - UB是否可以重用对象的存储而不先破坏它?

c++ - Visual Studio 2010 - 无法打开源文件 <QtGui/QApplication>

c++ - 如何优化具有已知瓶颈的计算密集型 C++ 程序?

automation - 最好的AutoHotKey宏?

c - 这个宏有什么问题?