nmake:是否可以禁用编译警告?
Microsoft nmake 工具将在构建过程中输出任何编译器警告。这在构建大型项目(如 Qt)时非常烦人。使用 nmake 时是否可以禁用警告显示?
Microsoft nmake tool will output any compiler warnings during build process. This is very annoying while building large projects (like Qt). Is it possible to disable warnings display while using nmake?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不是nmake向您显示警告,而是使用的编译器/工具/脚本。因此,您必须查看您的 Makefile,找出 nmake 正在调用哪些程序,并查看有关该工具的命令行选项的文档。例如,对于 Microsoft C++ 命令行编译器 cl,您可以添加“/w”以禁用所有警告。 cl /? 将显示可用选项列表。对于其他程序,其他命令行选项可能也适用。
如果你真的不喜欢看到任何输出,你可以调用
将所有输出发送到nirwana,但我很确定这不是你想要的。
Not nmake is showing you the warnings, but the compiler/tools/scripts that are used. So you have to look into your
Makefile
, find out which programs nmake is calling and look into their documentation about the command line options of this tools. For example, for the Microsoft C++ command line compiler cl, you can add "/w" to disable all warnings. cl /? will show you the list of available options. For other programs, other command line options may be appropriate.If you really do not like to see any output, you can call
sending all output to nirwana, but I am pretty sure that is not what you want.
对于 Microsoft 的 C/C++ 编译器,您可以使用 #pragma 指令禁用代码中的特定警告。
这将禁用警告 4005。当您包含可疑代码时,您可以重新启用警告:
For Microsoft's C/C++ compiler you can disable spesific warnings from the code using #pragma directives
This will disable warning 4005. When you have included the suspect code, you can re enable the warning:
首先,应该考虑并“解决”绝大多数警告。
其次,您可以按照指示使用#pragma,
第三种解决方案请参见此处:
禁用所有编译器警告
禁用单个编译器警告
将所有编译器警告视为编译错误
将单个编译器警告视为编译错误
first of all, the absolute majority of warnings should be taken in consideration and "resolved".
secondly, you can use #pragma as indicated Arve
the third solution see here:
To disable all compiler warnings
To disable a single compiler warning
To treat all compiler warnings as compilation errors
To treat a single compiler warning as a compilation errors