问题描述
与SunStudio11捆绑在一起的STLport会生成许多警告.我相信大多数编译器都有一种方法可以禁用某些源文件中的警告,例如:
The STLport bundled with the SunStudio11 generates alot of warnings. I beleive most compilers have a way to disable warnings from certain source files, like this:
Sun C
#pragma error_messages off
#include <header.h>
// ...
#pragma error_messages on
gcc
#pragma warning(push, 0)
#include <header.h>
// ...
#pragma warning(pop)
如何在SunStudio C ++编译器中执行此操作? (顺便说一下,sunstudio C编译指示不能在sunstudio C ++中工作)
How do you do this in the SunStudio C++ compiler? (btw, the sunstudio C pragmas don't work in sunstudio C++)
推荐答案
在SunStudio 12中,#pragma error_messages按照C用户手册中的说明工作.
In SunStudio 12, the #pragma error_messages work as documented in the C users manual.
您可以使用-errtags = yes选项查看标签,并像这样使用它:
You can see the tags with the -errtags=yes option, and use it like this:
// Disable badargtypel2w:
// String literal converted to char* in formal argument
#pragma error_messages (off, badargtypel2w )
,然后使用CC(C ++编译器)进行编译.
and then compile with CC (the C++ compiler).
这篇关于SunStudio C ++编译器编译指示可禁用警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!