1. 程式人生 > >Debug編譯執行都沒有問題,Release編譯錯誤error C2664: 'ATL::CStringT::CStringT(const VARIANT

Debug編譯執行都沒有問題,Release編譯錯誤error C2664: 'ATL::CStringT::CStringT(const VARIANT

平臺:Win7 X64   解決方法:project-Configuration Properties-General-Character Set選擇Use Multi-Byte Character Set

詳細編譯錯誤如下:

1>c:\program files\teledyne dalsa\sapera\classes\gui\LoadSaveDlg.h(27) : error C2664: 'ATL::CStringT<BaseType,StringTraits>::CStringT(const VARIANT &)' : cannot convert parameter 1 from 'char [260]' to 'const VARIANT &'
1>        with
1>        [
1>            BaseType=wchar_t,
1>            StringTraits=StrTraitMFC_DLL<wchar_t>
1>        ]
1>        Reason: cannot convert from 'char [260]' to 'const VARIANT'
1>        No constructor could take the source type, or constructor overload resolution was ambiguous
1>.\SaveShowDlg.cpp(144) : error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [28]' 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>.\SaveShowDlg.cpp(294) : error C2664: 'CComboBox::AddString' : cannot convert parameter 1 from 'char *' to 'LPCTSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>.\SaveShowDlg.cpp(346) : error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [71]' to 'LPCTSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>.\SaveShowDlg.cpp(430) : error C2665: 'AfxMessageBox' : none of the 2 overloads could convert all the argument types
1>        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxwin.h(5372): could be 'int AfxMessageBox(LPCTSTR,UINT,UINT)'
1>        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxwin.h(5374): or       'int AfxMessageBox(UINT,UINT,UINT)'
1>        while trying to match the argument list '(const char [10])'
1>.\SaveShowDlg.cpp(649) : error C2664: 'SapBuffer::Save' : cannot convert parameter 1 from 'CString' to 'const char *'
1>        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>SaveShow.cpp
1>c:\program files\teledyne dalsa\sapera\classes\gui\LoadSaveDlg.h(27) : error C2664: 'ATL::CStringT<BaseType,StringTraits>::CStringT(const VARIANT &)' : cannot convert parameter 1 from 'char [260]' to 'const VARIANT &'
1>        with
1>        [
1>            BaseType=wchar_t,
1>            StringTraits=StrTraitMFC_DLL<wchar_t>
1>        ]
1>        Reason: cannot convert from 'char [260]' to 'const VARIANT'
1>        No constructor could take the source type, or constructor overload resolution was ambiguous
1>Build log was saved at "file://e:\PR\SaveShow_0.12color\SaveShow\x64\Release\BuildLog.htm"
1>SaveShow - 7 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========