如题所示。我希望在编译过程中,编译器会报告给我一个警告信息,而这条警告信息可以由我自定义
#error不符合要求,他阻止了继续编译。
我查阅了msdn,发现以下文字:
compiler
Places the name and version number of the compiler in the object file. This comment record is ignored by the linker. If you supply a
commentstring parameter for this record type, the compiler generates a warning.
这条信息在
#pragma comment( comment-type [,"commentstring"] )
的注解当中。它提到了编译器将产生一个警告,但我使用时,却发现#pragma comment(compiler,"123")产生了如下警告:警告 1 warning C4081: 应输入“)”;找到“,” m:\c++实验\xxxxx\2-2\4\4\main.cpp 1 4
注意:我并没有寻求#pragma message的编译时输出,我期待输出一个警告,出现在IDE的错误列表中。
请指出能否实现,如能实现,请告知实现途径,谢谢。