可能重复:
C/C++行号
我想显示触发printf的行号?
它可能看起来像这样:
printf("the line number is: %d",SOME_LIBC_MACRO);
Run Code Online (Sandbox Code Playgroud)
怎么做?
sim*_*onc 12
使用__LINE__
宏
printf("the line number is: %d", __LINE__);
Run Code Online (Sandbox Code Playgroud)
GCC和Visual Studio可以使用其他预定义宏列表
归档时间: |
|
查看次数: |
2765 次 |
最近记录: |