参考点击打开链接
#include <stdio.h>
#ifdef __DEBUG__
#define DEBUG(format,...) printf("File: " __FILE__", Line: %05d: " format"\n", __LINE__, ##__VA_ARGS__)
#else
#define DEBUG(format,...)
#endif
int main()
{
char str[]="Hello World";
DEBUG("A ha, check me: %s\n",str);
return 0;
}
注意:::C++11要求,当字符串跟变量连接的时候,必须增加一个空格才行。