预编译标头智能感知错误
Precompiled Headers IntelliSense Error
>我在我正在处理的静态库项目中启用了预编译标头。环顾其他StackOverflow问题,似乎 #include"stdafx.h"的关键位置是在.cpp文件中,而不是.h文件中。
但是,当我在Visual Studio中执行此操作时,我收到一个IntelliSense错误:
1 智能感知:PCH 警告:标头停止不能位于宏或 #if 块中。 未生成智能感知 PCH 文件。....\通用\核心\几何\椭圆体.h 9
静态库项目确实成功编译,即使出现此智能感知错误也是如此。
.h文件由以下类声明组成:
#ifndef GEOMETRY_ELLIPSOID_H
#define GEOMETRY_ELLIPSOID_H
class Ellipsoid { // 'class' is underlined with a red line (error)
// ...
};
#endif // !GEOMETRY_ELLIPSOID_H
.cpp定义标头中声明的类:
#include "CommonCorestdafx.h"
#include "Ellipsoid.h"
// ...
通过在标头中包含 stdafx.h,intelliSense 错误将消失。这是使用预编译标头的正确方法吗?在标头中包含 stdafx.h 有什么含义?
您必须
在文件开头添加一次 #pragmaAnsare 在这里: PCH 警告: 标头停止不能在宏或 #if 块 - Visual C++ 2010 Express SP1宏观或如果块视觉 C-2010-exp
相关文章:
- 警告处理为错误这里有什么问题
- "error: no matching function for call to"构造函数错误
- 设置我的应用程序 API 感知并防止系统使其模糊和错误定位
- 我在代码中有一个错误,错误是:(智能感知:不允许抽象类类型"HourlyWorker"的对象:)
- VS 2017 中的标头 cmath 智能感知错误
- 错误太多,智能感知引擎无法正常运行
- 我在C++文件中的简单代码块上有 2 个错误。错误 C2059:语法错误:"?"。第二智能感知:预期表达式。怎么了?
- condition.wait_for智能感知错误
- VS Express 2012 C++ lambda 智能感知错误
- 错误:智能感知:标识符"uint32"未定义?
- vector.push_back() 智能感知错误
- 智能感知说错误:成员"Class::field"无法访问,但它仍然有效?为什么?
- 预编译标头智能感知错误
- 无法使用大括号初始化智能感知错误调用基类构造函数
- 智能感知错误标识符"emlrtStack"未定义
- "Expected a c++ keyword" 在 atlbase.h 中 智能感知中的错误
- C++错误未声明的标识符,但殷智感知不显示错误
- 为什么sqrt()在智能感知中使用两个pow()的内部计算是错误的
- C++ 标准模板库的智能感知错误:<error-type>*?
- 映射和节点,错误智能感知:不存在从"const std::pair<const int, double>"到"Node"的合适用户定义转换