_com_util::ConvertBSTRToString' : cannot convert parameter 1 from 'String' to to 'BSTR'
来源:互联网 发布:来个淘宝买水果靠谱的 编辑:程序博客网 时间:2024/06/07 19:55
《Com原理与应用》源代码在VS2008上无法运行出现
Error 1 error C2664: '_com_util::ConvertBSTRToString': cannot convert parameter 1 from 'String' to 'BSTR'错误
经过深入的查找谷歌:
首先尝试强转解决部分问题char *pWord = _com_util::ConvertBSTRToString(reinterpret_cast<wchar_t*>(word));
出现新问题:
Error 18 error LNK2019: unresolved external symbol "char * __stdcall _com_util::ConvertBSTRToString(wchar_t *)" (?ConvertBSTRToString@_com_util@@YGPADPA_W@Z) referenced in function "public: virtual int __stdcall CDictionary::LoadLibraryA(unsigned short *)" (?LoadLibraryA@CDictionary@@UAGHPAG@Z) DictComp.obj
通过查看http://ziliao1.com/Article/Show/8C8706E9913788410DC1DCF243F14B14才知道没有设置wchar_t为本机字符类型
指定后,类型 wchar_t 将成为本机类型,该本机类型映射到__wchar_t 的方式与 short 映射到 __int16 的方式相同。默认情况下,/Zc:wchar_t 处于打开状态。
在 Visual Studio 开发环境中设置此编译器选项
打开项目的“属性页”对话框。 有关详细信息,请参见使用项目属性。
单击“C/C++”文件夹。
单击“语言”属性页。
修改“将 wchar_t 视为内置类型”属性。
问题解决!
- _com_util::ConvertBSTRToString' : cannot convert parameter 1 from 'String' to to 'BSTR'
- cannot convert parameter 1 from 'std::string' to 'const char *'
- Convert From BSTR to String
- cannot convert parameter 1 from 'class A' to 'class A'
- cannot convert parameter 1 from 'CString' to 'const char *'
- cannot convert parameter 1 from 'const char *' to 'LPCWSTR
- cannot convert parameter 1 from 'TCHAR [32]' to 'char *'
- error:cannot convert parameter 1 from 'unsigned char *' to 'char *'
- cannot convert parameter 1 from 'char *' to 'LPCWSTR'
- cannot convert parameter 1 from 'TCHAR [260]' to 'WCHAR *'
- cannot convert parameter 1 from 'int' to 'int []'
- VS2010 cannot convert parameter 1 from 'char *' to 'LPCWSTR'
- VS2008中报错:cannot convert parameter 2 from 'char *' to 'LPCWSTR'
- cannot convert parameter from 'class CStdioFile' to 'class CStdioFile'
- VS2005中报错:cannot convert parameter 2 from 'char *' to 'LPCWSTR'
- cannot convert parameter 2 from 'const char[15]' to 'LPWSTR';
- error C2664: 'cvSetMouseCallback' : cannot convert parameter 2 from ....to'CvMouseback'
- 'strcpy' : cannot convert parameter 2 from 'LPCTSTR' to 'const char *'
- Codeforces Round #240 (Div. 2)
- oracle表查询
- #pragma once与 #ifndef的区别
- web应用和虚拟目录的映射
- 黑马程序员-我的第十八篇学习日记:Foundation中的NSArray和NAMutableArray
- _com_util::ConvertBSTRToString' : cannot convert parameter 1 from 'String' to to 'BSTR'
- poj_1753 递归+枚举
- Cryptographic signing 记忆线索
- hdu 1013 Digital Roots
- 最大流-hdoj-1532
- AJAX笔试面试题汇总
- github版本库使用详细教程(命令行及图形界面版)
- vim常用命令整理
- hdoj 2531 Catch him(BFS)