zoukankan      html  css  js  c++  java
  • 日常积累:

    将在VC6中编译好的工程放在VS2005中编译结果出现问题:

       1:          CString test;
       2:          test.Format("this is for test ");

    就是上面这句代码

    visual studio 2005projectsvc6testvc6testvc6test.cpp(22) : error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [18]' to 'const wchar_t *'
    1>        with
    1>        [
    1>            BaseType=wchar_t,
    1>            StringTraits=StrTraitMFC_DLL<wchar_t>
    1>        ]
    1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    1>生成日志保存在“file://d:我的文档Visual Studio 2005Projectsvc6testvc6testDebugBuildLog.htm”

    网上查找解决办法由两个:

       1:  #include <tchar.h>
       2:  CString test;   
       3:  test.Format(_T("this is for test "));
    1>vc6test.cpp
    1>生成日志保存在“file://d:我的文档Visual Studio 2005Projectsvc6testvc6testDebugBuildLog.htm”
    1>vc6test - 0 个错误,0 个警告

    这样就可以编译过去了,

    第二种方法:

    image

    在VS2005的工程的属性页中找到,这个字符集 使用多字节字符集 ,同样也可以编译通过

    1>正在删除项目“vc6test”(配置“Debug|Win32”)的中间文件和输出文件
    1>正在编译...
    1>stdafx.cpp
    1>正在编译...
    1>vc6test.cpp
    1>正在编译资源...
    1>正在编译资源清单...
    1>正在链接...
    1>LINK : 没有找到 D:我的文档Visual Studio 2005Projectsvc6testDebugvc6test.exe 或上一个增量链接没有生成它;正在执行完全链接
    1>正在嵌入清单...
    1>生成日志保存在“file://d:我的文档Visual Studio 2005Projectsvc6testvc6testDebugBuildLog.htm”
    1>vc6test - 0 个错误,0 个警告
    ========== 全部重新生成: 1 已成功, 0 已失败, 0 已跳过 ==========

    具体的原因是:

    VS2005默认采用的是UNICODE字符,这样英语字符是一个字母占用两个字节,而在vc6下采用的则是ANSI字节,一个英语字符占用一个字节,因此会出问题。

  • 相关阅读:
    AngularJS双向绑定,手动实施观察
    AngularJS的Hello World
    LESS碎语
    chrome浏览器调试报错:Failed to load resource: the server responsed width a status of 404 (Not Found)…http://127.0.0.1:5099/favicon.ico
    AngularJS报错:[$compile:tpload]
    Javascript中的依赖注入
    使用HTML5和CSS3碎语
    在Brackets中使用Emmet
    使用Brackets
    Bootstrap碎语
  • 原文地址:https://www.cnblogs.com/hwtxf/p/3508020.html
Copyright © 2011-2022 走看看