cannot convert parameter 1 from 'const char [3] ' to 'const wchar_t * ' 解决方法

查阅各种资料的标准做法似乎为
CString       a;      
    int       b;      
    a.Format( "%d ",b);      
    TEXTOUT(a);

但我使用这种方法总是提示编译错误
c:\documents   and   settings\administrator\my   documents\visual   studio   2005\projects\imageprocess\imageprocess\imageprocessview.cpp(137)   :   error   C2664:   'void   ATL::CStringT <BaseType,StringTraits> ::Format(const   wchar_t   *,...) '   :   cannot   convert   parameter   1   from   'const   char   [3] '   to   'const   wchar_t   * '
                with
                [
                        BaseType=wchar_t,
                        StringTraits=StrTraitMFC_DLL <wchar_t>
                ]
                Types   pointed   to   are   unrelated;   conversion   requires   reinterpret_cast,   C-style   cast   or   function-style   cast


/////////////////////////////////////////
解决方法:
cannot   convert   parameter   1   from   'const   char   [3] '   to   'const   wchar_t   * '

从这个看你可能采用了UNICODE编码,
可以用
a.Format(L "%d ",   b);
或者
a.Format(_T( "%d "),   b);

贴子来源Diy部落(http://bbs.diybl.com) 详细出处参考:http://bbs.diybl.com/dview61t13393.html

posted on 2010-02-24 10:23 wrh 阅读(12653) 评论(1)  编辑 收藏 引用

评论

# re: cannot convert parameter 1 from 'const char [3] ' to 'const wchar_t * ' 解决方法 2011-06-20 13:36 hi

thank you  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

<2024年3月>
252627282912
3456789
10111213141516
17181920212223
24252627282930
31123456

统计

常用链接

留言簿(19)

随笔档案

文章档案

收藏夹

搜索

最新评论

阅读排行榜

评论排行榜