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 警告?


基础教程推荐
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 常量变量在标题中不起作用 2021-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 这个宏可以转换成函数吗? 2022-01-01