rainbowzc

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: :: :: 管理 ::

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__"自定义消息")

 

posted on 2013-02-21 16:16  ct  阅读(397)  评论(0编辑  收藏  举报