c++ - MFC:CSting IntelliSense:没有重载函数的实例

标签 c++ mfc

当我将int转换为CString时,源代码如下所示

int count = 0;
CString msg;
msg.Format("%d", count); // error

错误信息是

IntelliSense: no instance of overloaded function
"ATL::CStringT::Format [with
BaseType=wchar_t, StringTraits=StrTraitMFC_DLL ATL::ChTraitsCRT>]" matches the argument list
argument types are: (const char [4]) object type is:
CString

我该如何解决这个问题?

最佳答案

在 _T() 中包含“%d”

msg.Format(_T("%d"), count); 

关于c++ - MFC:CSting IntelliSense:没有重载函数的实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22370247/

相关文章:

c++ - Eclipse、minGW 和 C++11

c++ - 为什么允许根据用户输入声明具有大小的自动数组?

c++ - MFC + Wininet + 代理身份验证 = 问题

winapi - SetTimer 与 CWnd::SetTimer

c++ - 如何拍摄 View 的屏幕截图并将图片插入 MS-Word 文档

c++ - 在 MFC 的 CListCtrl 中禁用多个项目的按钮

c++ - 什么情况比较好?

c++ - 仿函数和迭代槽 vector

c++ - 将数组传递给函数 C++

c++ - 是否有 C++/Win32/MFC(如 Sparkle)的自动更新框架?