在Visual Studio 2010中将输出消息写入“输出窗口"的最简单方法? [英] Simplest way to write output message to 'output window' in Visual Studio 2010?

查看:485
本文介绍了在Visual Studio 2010中将输出消息写入“输出窗口"的最简单方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试过OutputDebugString函数,并且在大多数情况下,我会收到如下错误:

I've tried OutputDebugString function and most of the time I get error like :

error C2664: 'OutputDebugStringA' : cannot convert parameter 1 from 'int' to 'LPCSTR'

请提出建议.谢谢.

推荐答案

它仅接受字符串作为参数,而不接受整数.尝试类似

It only accepts a string as a parameter, not an integer. Try something like

sprintf(msgbuf, "My variable is %d\n", integerVariable);
OutputDebugString(msgbuf);

有关更多信息,请查看 http://www.unixwiz.net/techtips/outputdebugstring .html

For more info take a look at http://www.unixwiz.net/techtips/outputdebugstring.html

这篇关于在Visual Studio 2010中将输出消息写入“输出窗口"的最简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆