如何在printf中显示我的源代码的行号
How to display the line number of my source code in printf
可能的重复:
C/C 线号
我想显示触发printf的行号?
看起来像这样:
printf("the line number is: %d",SOME_LIBC_MACRO);
如何做?
使用__LINE__
宏
printf("the line number is: %d", __LINE__);
其他预定型宏的列表可用于GCC和Visual Studio
相关文章:
- C++问题,我的两个源代码应该具有相同的输出,但它们是不同的
- SQLite - 从源代码构建库或将源代码直接包含在我的项目中
- 如何在我的源代码中找到所有发生的情况,其中std :: string被传递给方法作为副本而不是恒定引用
- 如何共享我的 C/C++ 项目并隐藏一些源代码
- 如何在我的C++项目中使用 CLIPS 源代码
- 如何在printf中显示我的源代码的行号
- 我正在为我的C 项目添加Offocial SQLite源代码,并获得链接器错误
- 如何在不将库源代码添加到我的项目中的情况下将库链接到 CodeBlocks 和 GCC 中的项目
- 如何将 Open GL 驱动程序中的分段错误追溯到我的源代码
- 使用更新的 gcc 编译器从 c++ 切换到代码块,这会导致我的源代码中出现错误,这些源代码使用旧的 gcc 编译器 v
- 设置我的源代码,构建目录和制作工具
- G++ 不会使用 -O0 编译我的源代码,但它使用 -O2 -DNDEBUG 编译源代码,我该如何解决它
- 请帮助我与我的源代码c++
- 如何检查如果MS编译器将编译我的源代码
- 试图让我的游戏在VC 2010中运行,似乎无法链接SOIL库,不知道如何链接,包括游戏源代码
- g++没有编译我的源代码.也许是模板错误
- 如何检测我的源代码中使用了哪些 C++11 功能
- 分析我的代码(开源)和第三方代码(封闭源代码)的内存使用情况的最佳策略
- 添加下载的c++源代码到我的项目时的良好实践
- 我的源代码是否显示了我自己对c++中结构的理解