visual-studio 如何增加 Visual Studio 中的错误限制?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2880936/
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
How to increase error limit in Visual Studio?
提问by Oleksii Skidan
When building an app. VS will complain of exceeded error count:
在构建应用程序时。VS 会抱怨超出错误计数:
fatal error C1003: error count exceeds 100; stopping compilation
Is there a way to increase the limit?
有没有办法增加限制?
Thanks in advance,
- Oleksii Skidan
提前致谢,
- Oleksii Skidan
回答by Dmitry Egorenkov
This limitation is hardcoded. Here is the post from the MSFT employee in the microsoft.public.vsnet.generalgroup dated 2006 (look for 'Fatal Error C1003'):
此限制是硬编码的。以下是microsoft.public.vsnet.general2006 年小组中MSFT 员工的帖子(查找“致命错误 C1003”):
Hi,
Unfortunately this 100 limitation is hard coded and cannot be changed. It's just inpractical to keep all errors information around since one error may cause other several errors.
I hope you understand the rational behind this design by our product team. However, if you still have concerns about this, please feel free to submit your feedback at
http://connect.microsoft.com/Main/content/content.aspx?ContentID=2220which is monitored by our product team. Thank you for your understanding.Sincerely, Walter Wang ([email protected], remove 'online.') Microsoft Online Community Support"
你好,
不幸的是,这个 100 限制是硬编码的,无法更改。保留所有错误信息是不切实际的,因为一个错误可能会导致其他几个错误。
我希望您了解我们产品团队的这种设计背后的合理性。但是,如果您对此仍有疑虑,请随时 通过我们的产品团队监控的
http://connect.microsoft.com/Main/content/content.aspx?ContentID=2220提交您的反馈。感谢您的理解。此致,Walter Wang ([email protected],删除“在线”。) Microsoft 在线社区支持”
回答by msteiger
I don't think so. VS basically reports all errors it encounters during compilations. There might be some erroneous parts of the code that make the compiler getting caught in an infinite "error" loop.
我不这么认为。VS 基本上会报告它在编译过程中遇到的所有错误。代码中可能存在一些错误部分,使编译器陷入无限的“错误”循环。
The limit was implemented to avoid that. In most cases the 100 errors you get are just the same error reported over and over again. What would be the sense in increasing the number of repetitions?
实施限制是为了避免这种情况。在大多数情况下,您得到的 100 个错误只是一次又一次报告的相同错误。增加重复次数有什么意义?
Maybe you can post the code snippet where the error occurs first, so we can help you fix it.
也许您可以发布最先出现错误的代码片段,以便我们帮助您修复它。
回答by Paul Butcher
I believe that it is a hard-coded limit, so no.
我相信这是一个硬编码限制,所以不是。
As others have commented, it's difficult to understand what you want to achieve by this.
正如其他人所评论的那样,很难理解您想要通过此实现什么。
At the end of the day, you'll have to fix them all, so get stuck in and start fixing them. Eventually, you'll get below 100, and you can start counting them.
归根结底,您必须将它们全部修复,因此陷入困境并开始修复它们。最终,您将低于 100,您可以开始计算它们。
It is not normally valuable to report the actual number of errors when this occurs. Most of the time, when you get C1003, it's actually only a few realerrors, leading to a massive chain of other errors.
发生这种情况时,报告实际错误数通常没有价值。大多数情况下,当您获得 C1003 时,它实际上只是一些真正的错误,从而导致大量其他错误。
(e.g.)
(例如)
- If there is an error in a .h file, that error will be reported in every .cpp file that
#includesit. - If there is an error that prevents any kind of identifier being defined (e.g. a class, variable, method name), then every time you try to use it later on, an error will be reported.
- 如果 .h 文件中存在错误,则该错误将在每个 .cpp 文件中
#includes报告。 - 如果有错误阻止定义任何类型的标识符(例如类、变量、方法名称),那么以后每次尝试使用它时,都会报告错误。
回答by paperjam
Workaround to reducenumber of reported errors:
减少报告错误数量的解决方法:
- rename cl.exe to cl-orig.exe
- roll your own cl.exe that launches cl-orig.exe, capturing its stdout / stderr
- parse stderr, looking for error messages and counting them
- breaks after first n errors
- 将 cl.exe 重命名为 cl-orig.exe
- 启动您自己的 cl.exe 来启动 cl-orig.exe,捕获其 stdout/stderr
- 解析 stderr,查找错误消息并对其进行计数
- 在前 n 个错误后中断
See http://msdn.microsoft.com/en-us/library/ms682499(v=vs.85).aspxfor some hints.
有关一些提示,请参阅http://msdn.microsoft.com/en-us/library/ms682499(v=vs.85).aspx。
回答by Luis
I also have a project like this: sometimes Visual Studio decides there is a lot to do, emits 100 really irrelevant messages about other parts of the solution and aborts the build because it reached the message limit without working on the project I'm interested on.
我也有一个这样的项目:有时 Visual Studio 决定有很多事情要做,发出 100 条关于解决方案其他部分的真正不相关的消息并中止构建,因为它在没有处理我感兴趣的项目的情况下达到了消息限制.
The workaround we have found is to use msbuild to build the solution from a command prompt: the Use MSBuildwalkthrough outlines the steps. msbuild outputs all messages to the console and once the build completes we can work and debug again in Visual Studio. Not ideal, but it lets us complete the task at hand.
我们找到的解决方法是使用 msbuild 从命令提示符构建解决方案:使用 MSBuild演练概述了这些步骤。msbuild 将所有消息输出到控制台,一旦构建完成,我们就可以在 Visual Studio 中再次工作和调试。不理想,但它可以让我们完成手头的任务。

