小白问题,sdk下,除了assert,还有哪些常用的方便调试的东东

madpc 2009-02-27 10:01:38
sdk下,除了assert,还有哪些常用的方便调试的东东??

比如如何方便查看一个数值或文本,也就是变量的值

最好适用于g++

希望能言无不尽, 谢谢
...全文
130 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
ForestDB 2009-03-02
  • 打赏
  • 举报
回复
printf
log4c++
  • 打赏
  • 举报
回复
G++一样可以使用SDK的 自然也能使用OutputDebugString

输出数字的话先转化成字符串即可.
lbjfeng 2009-03-02
  • 打赏
  • 举报
回复
不过是vc下的
TRACE
madpc 2009-03-02
  • 打赏
  • 举报
回复
winform 的不能用 printf 吧
madpc 2009-02-27
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 akirya 的回复:]
C/C++ codevoidWINAPI OutputDebugString(
__in_opt LPCTSTR lpOutputString
);
[/Quote]

如果要输出数字呢?
waizqfor 2009-02-27
  • 打赏
  • 举报
回复
[Quote=引用楼主 madpc 的帖子:]
sdk下,除了assert,还有哪些常用的方便调试的东东??

比如如何方便查看一个数值或文本,也就是变量的值

最好适用于g++

希望能言无不尽, 谢谢
[/Quote]
OutputDebugString就可以了
If the application has no debugger, the system debugger displays the string. If the application has no debugger and the system debugger is not active, OutputDebugString does nothing.

OutputDebugStringW converts the specified string based on the current system locale information and passes it to OutputDebugStringA to be displayed. As a result, some Unicode characters may not be displayed correctly.

Applications should send very minimal debug output and provide a way for the user to enable or disable its use. To provide more detailed tracing, see Event Tracing.

fox000002 2009-02-27
  • 打赏
  • 举报
回复
可以用 gdb 或相关的 debug 工具
  • 打赏
  • 举报
回复
void WINAPI OutputDebugString(
__in_opt LPCTSTR lpOutputString
);
OenAuth.Net 2009-02-27
  • 打赏
  • 举报
回复
还是printf好使
oyljerry 2009-02-27
  • 打赏
  • 举报
回复
printf等打印好了,还可以格式化数字,字符串等
g++也可以
  • 打赏
  • 举报
回复
帮顶吧
lingyin55 2009-02-27
  • 打赏
  • 举报
回复
g++不懂,帮顶
疯哥哥 2009-02-27
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 madpc 的回复:]
引用 1 楼 akirya 的回复:
C/C++ codevoidWINAPI OutputDebugString(
__in_opt LPCTSTR lpOutputString
);


如果要输出数字呢?
[/Quote]
路过.g++貌似没有OutputDebugString吧,这个是VC的.
数字的话可以用itoa转换成字符串..

g++没有调试经验(除了运行时使用printf外).帮顶.

65,211

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧