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

 

相关文章:

  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2021-11-24
  • 2022-02-07
  • 2021-11-05
猜你喜欢
  • 2021-06-10
  • 2022-01-06
  • 2021-06-01
  • 2022-12-23
  • 2021-07-20
  • 2022-12-23
相关资源
相似解决方案