Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: C/C++ 行号
我想显示触发 printf 的行号?
它可能看起来像这样:
printf("the line number is: %d",SOME_LIBC_MACRO);
怎么做?
使用__LINE__宏
__LINE__
printf("the line number is: %d", __LINE__);
其他预定义宏的列表可用于GCC和Visual Studio