C++ Visual Studio 中的这些 .pch 和 .ncb 文件是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9240881/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 12:31:32  来源:igfitidea点击:

What are these .pch and .ncb files in visual studio?

c++visual-studiovisual-c++visual-studio-express

提问by Victor

I have several small Visual Studio Projects (C++). And many of these projects have .ncb and .pch extension files. Those files are quite big, and they are consuming a lot of space (over 100 mb).

我有几个小的 Visual Studio 项目(C++)。其中许多项目都有 .ncb 和 .pch 扩展文件。这些文件非常大,而且它们占用了大量空间(超过 100 mb)。

What are these files?

这些文件是什么?

If those files are not that important can I delete them? Can I stop them from being created?

如果这些文件不是那么重要,我可以删除它们吗?我可以阻止它们被创建吗?

回答by ybungalobill

PCH is the precompiled headersfile. It's a temporary that you can safely delete. You can disable its creation through Project Settings > C++ > Precompiled Headers > Don't use precompiled headersand removing the stdafx.cpp file from your project.

PCH 是预编译的头文件。这是一个可以安全删除的临时文件。您可以通过Project Settings > C++ > Precompiled Headers > Don't use precompiled headers并从项目中删除 stdafx.cpp 文件来禁用它的创建。

NCB is the database used by IntelliSense to allow you to browse the symbols defined in your project, including the inline hints and auto completion as you type. You can safely delete it. There is an option to disable IntelliSense too.

NCB 是 IntelliSense 使用的数据库,允许您浏览项目中定义的符号,包括内联提示和键入时的自动完成。您可以安全地删除它。还有一个选项可以禁用 IntelliSense

However, both features may be useful; therefore you may not want to disable them. If you worry about the size of the backups or sending the projects to some other programmer, then you can just clean the project by removing said files.

但是,这两个功能都可能有用;因此您可能不想禁用它们。如果您担心备份的大小或将项目发送给其他程序员,那么您可以通过删除所述文件来清理项目。

回答by Bo Persson

pch = pre-compiled header
ncb = non-compiled browse

pch = 预编译头文件
ncb = 非编译浏览

The files are pretty important if you want to use the features they support. Not using pre-compiled headers will get rid of the first one. Don't know about the code browse support.

如果您想使用它们支持的功能,这些文件非常重要。不使用预编译头将摆脱第一个。不知道代码浏览支持。

回答by Lol4t0

Ncbis Intellisense database, while .pchis precompiled header

Ncb智能感知数据库.pch而是预编译头

You can remove those files but they will be regenerated automatically

您可以删除这些文件,但它们会自动重新生成