Visual Studio 2005 (C++) 默认警告级别
我正在使用 MS Visual Studio 2005 进行 C++ 的新开发。为此,我需要向我的解决方案添加几个新项目。 我总是将警告级别设置为 4,并打开“将警告视为错误”(项目 -> 属性 -> c++ -> 常规)。
有没有办法告诉 Visual Studio 这是我的默认设置,这样我就不必为我创建的每个新项目都执行此操作?
I'm working on a new development in C++, using MS Visual Studio 2005. For this, I need to add several new projects to my solution. I always set my warning level to 4, and turn on "treat warnings as errors" (project -> properties -> c++ -> general).
Is there a way for me to tell Visual Studio that this is my default so I don't have to do it for each new project I create?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,唯一的方法是修改向导。 这并不像听起来那么难。
转到您的 Visual Studio 目录。 打开VC\VCWizards\1033目录,然后打开common.js文件。 现在,搜索函数 AddCommonConfig。
现在,要将默认警告级别设置为 4,请找到“CLTool.WarningLevel = WarningLevel_3;”行 并将其更改为“CLTool.WarningLevel = WarningLevel_4;” (注意:它为调试和发布配置设置了两次,因此请确保对两者进行更改。)
现在,要使其将警告视为错误,请添加一行(对于这两种配置)“CLTool.WarnAsError = true;”
但请注意,这将更改所有默认 VC 向导的这些设置(但您可能仍然需要这样做。)
The only way, that I know, is to modify the wizard. This isn't as hard as it sounds.
Go to your Visual Studio directory. Open VC\VCWizards\1033 directory, and open the common.js file. Now, search for the function AddCommonConfig.
Now, to set the default warning level to 4, find the line "CLTool.WarningLevel = WarningLevel_3;" and change it to "CLTool.WarningLevel = WarningLevel_4;" (note: it is set twice for debug and release configurations, so make sure you change it for both.)
Now, to make it treat warnings as errors, add a line (for both configurations) "CLTool.WarnAsError = true;"
Note, however, that this will change these settings for all the default VC wizards (but you probably want that anyway.)