头文件已经加上了.编译的各种选项都试过了__cdecl/__fastcall/__stdcall都试了.怎么办.我快崩溃了
#pragma comment( lib, "comsupp" )
void CTestClientAtlDlg::OnBnClickedBtnTest()
{
// TODO: 在此添加控件通知处理程序代码
CComBSTR strName = "xxx";
strName = _com_util::ConvertStringToBSTR( _T( "i hate you ! ConvertStringToSTR() ! " ));
spTest->FireAttribute( strName.Detach() );
}Error msg:
error LNK2019: 无法解析的外部符号 "wchar_t * __stdcall _com_util::ConvertStringToBSTR(char const *)" (?ConvertStringToBSTR@_com_util@@YGPA_WPBD@Z) ,该符号在函数 "public: void __thiscall CTestClientAtlDlg::OnBnClickedBtnTest(void)" (?OnBnClickedBtnTest@CTestClientAtlDlg@@QAEXXZ) 中被引用
Debug/TestClientAtl.exe : fatal error LNK1120: 1 个无法解析的外部命令
#pragma comment( lib, "comsupp" )
void CTestClientAtlDlg::OnBnClickedBtnTest()
{
// TODO: 在此添加控件通知处理程序代码
CComBSTR strName = "xxx";
strName = _com_util::ConvertStringToBSTR( _T( "i hate you ! ConvertStringToSTR() ! " ));
spTest->FireAttribute( strName.Detach() );
}Error msg:
error LNK2019: 无法解析的外部符号 "wchar_t * __stdcall _com_util::ConvertStringToBSTR(char const *)" (?ConvertStringToBSTR@_com_util@@YGPA_WPBD@Z) ,该符号在函数 "public: void __thiscall CTestClientAtlDlg::OnBnClickedBtnTest(void)" (?OnBnClickedBtnTest@CTestClientAtlDlg@@QAEXXZ) 中被引用
Debug/TestClientAtl.exe : fatal error LNK1120: 1 个无法解析的外部命令
Unresolved external errors may occur when you compile with a default calling convention of __fastcall (/Gr) or __stdcall (/Gz) and call ConvertStringToBSTR or ConvertBSTRToString. CAUSE
The prototypes are missing the __cdecl calling convention, which is the calling convention of these functions in comsupp.lib. RESOLUTION
Build with __cdecl as the default calling convention. Do not build with __fastcall or __stdcall as the default calling convention.
和
#pragma comment(lib, "comsupp")
是一样地`
Unresolved external errors may occur when you compile with a default calling convention of __fastcall (/Gr) or __stdcall (/Gz) and call ConvertStringToBSTR or ConvertBSTRToString. CAUSE
The prototypes are missing the __cdecl calling convention, which is the calling convention of these functions in comsupp.lib. RESOLUTION
Build with __cdecl as the default calling convention. Do not build with __fastcall or __stdcall as the default calling convention.
===================================================
不错。