How do I stop an IntelliSense PCH Warning?(如何停止 IntelliSense PCH 警告?)
问题描述
我的一些头文件没有包含,所以我在 Visual Studio 2010 中收到此消息:
A few of my header files have no includes, so I receive this message in Visual Studio 2010:
IntelliSense: PCH warning: cannot find a suitable header stop location. An intellisense PCH file was not generated.
如果我添加一个标题,例如:
If I add a single header, for instance:
#include <iostream>
它消失了.如何在不添加(可能未使用的)包含的情况下阻止显示此错误>
It disappears. How can I stop this error from showing without adding (potentially unused) include>
推荐答案
添加 .cpp 文件时,它会继承项目的 PCH 设置.问题更详细的解释这里
When adding a .cpp file it inherits the PCH settings of the project. More detailed explanation of the problem here
解决方案:
- 在文件开头添加
#pragma once
.
这将导致您的源文件在单个编译中只包含一次,因此编译器将得到满足并且不需要额外的 #include
It will cause your source file to be included only once in a single compilation, therefore the compiler will be satisfied and won't require additional #include
- 将您的项目设置为不使用预编译头文件
- 为您添加的那个 cpp 文件禁用 PCH 使用,这将清除 IntelliSense 和编译器警告/错误.
注意!我将 num 2 和 3 包括在内,因为有人说它有帮助,但只有 num 1 确实解决了我的问题.
Note! I'm including num 2, and 3 because some say it helped, but it only num 1 that did solve my case.
这篇关于如何停止 IntelliSense PCH 警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何停止 IntelliSense PCH 警告?


- Stroustrup 的 Simple_window.h 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- C++ 协变模板 2021-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- 近似搜索的工作原理 2021-01-01
- 静态初始化顺序失败 2022-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 从python回调到c++的选项 2022-11-16