vc中自定义编译时的输出消息 .

VC中可以自定义编译输出消息

#pragma message("Insert User-defined Information here!")

但是这样没有文件和行数信息,不能定位。

使用如下方式可以定位:

1 // put the following code in header file or at the beginning of the source file.
2 #define __STR2__(x) #x
3 #define __STR1__(x) __STR2__(x)
4 #define __LOC__ __FILE__ "("__STR1__(__LINE__)") : Warning Msg: "
5 
6 // output the user-define information in the source file.
7 #pragma message(__LOC__"自定义消息")
原文地址:https://www.cnblogs.com/rainbowzc/p/2920821.html