原版的代码编译没错,为什么加入到我的代码出错了?(代码我是直接导入的) 是缺少什么头文件造成的吗?
达人们,偶急需解决~~~错误1 error C2664: '_wcsicmp' : cannot convert parameter 1 from 'char *' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast错误2 error C2664: 'wsprintfW' : cannot convert parameter 1 from 'char [8]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast错误3 error C2664: 'wsprintfW' : cannot convert parameter 1 from 'char [8]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
HRESULT
CBehavior::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames,
LCID lcid, DISPID* rgdispid)
{
HRESULT hr = DISP_E_UNKNOWNNAME; USES_CONVERSION; if (!rgszNames || !rgdispid )
return E_POINTER; for (int i = 0; m_szMethodNames[i] != NULL; i++)
{
if ( 0 == _tcsicmp( m_szMethodNames[i], OLE2A(*rgszNames) ) )//先把两字符串转化为小写后再比较。
{
*rgdispid = m_dispidMethodIDs[i];
hr = S_OK;
}
} return hr;
}void
CBehavior::ShowBehavior()
{
CComPtr<IHTMLStyle> spStyle;
HRESULT hr; hr = m_spElem->get_style( &spStyle );
if ( SUCCEEDED(hr) )
{
DWORD color;
char buf[8];
color = GetSysColor( m_lTextColorIndex );
wsprintf( buf, "#%02x%02x%02x", GetRValue(color), GetGValue(color), GetBValue(color) );
spStyle->put_color( CComVariant(buf) ); color = GetSysColor( m_lBackColorIndex );
wsprintf( buf, "#%02x%02x%02x", GetRValue(color), GetGValue(color), GetBValue(color) );
spStyle->put_backgroundColor( CComVariant(buf) );
}
}
达人们,偶急需解决~~~错误1 error C2664: '_wcsicmp' : cannot convert parameter 1 from 'char *' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast错误2 error C2664: 'wsprintfW' : cannot convert parameter 1 from 'char [8]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast错误3 error C2664: 'wsprintfW' : cannot convert parameter 1 from 'char [8]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
HRESULT
CBehavior::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames,
LCID lcid, DISPID* rgdispid)
{
HRESULT hr = DISP_E_UNKNOWNNAME; USES_CONVERSION; if (!rgszNames || !rgdispid )
return E_POINTER; for (int i = 0; m_szMethodNames[i] != NULL; i++)
{
if ( 0 == _tcsicmp( m_szMethodNames[i], OLE2A(*rgszNames) ) )//先把两字符串转化为小写后再比较。
{
*rgdispid = m_dispidMethodIDs[i];
hr = S_OK;
}
} return hr;
}void
CBehavior::ShowBehavior()
{
CComPtr<IHTMLStyle> spStyle;
HRESULT hr; hr = m_spElem->get_style( &spStyle );
if ( SUCCEEDED(hr) )
{
DWORD color;
char buf[8];
color = GetSysColor( m_lTextColorIndex );
wsprintf( buf, "#%02x%02x%02x", GetRValue(color), GetGValue(color), GetBValue(color) );
spStyle->put_color( CComVariant(buf) ); color = GetSysColor( m_lBackColorIndex );
wsprintf( buf, "#%02x%02x%02x", GetRValue(color), GetGValue(color), GetBValue(color) );
spStyle->put_backgroundColor( CComVariant(buf) );
}
}
http://kb.cnblogs.com/a/1721715/
并将c/c++ 预处理器-》预处理器宏定义 _UNICODE UNICODE删除
这样做出现了,很多错误,希望不要这样!
1,指针成员的表示方法(就有两项)
2,允许异常处理
3,允许时间类型信息……
4…… 看名字都不通没有看到 w_char 啊!
error C2065: 'tcsicmp' : undeclared identifier这样做有什么坏处!希望达人讲明~~多谢!
Behavior.cpp
Linking...
Creating library ReleaseUMinDependency/vbMHWB.lib and object ReleaseUMinDependency/vbMHWB.exp
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
ReleaseUMinDependency/vbMHWB.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...
在所有字符串前家个大些的'L'
如:
L"string"
方法二:
用_T将字符串括起来
如
_T("string")
方法三:
配置属性-》常规-》使用多字节字符集(VS2008)
应该是使用UNICODE字符集。。看没清楚,请原谅
方法三绝对不管用因为我忘记它不是改字符串的默认属性了。应该这样改源:
或者用方法一和二(差不多的) sprintf( buf, "#%02x%02x%02x", GetRValue(color), GetGValue(color), GetBValue(color) );
spStyle->put_color( CComVariant(buf) ); color = GetSysColor( m_lBackColorIndex );
sprintf( buf, "#%02x%02x%02x", GetRValue(color), GetGValue(color), GetBValue(color) );就是少了个w而已。。
w是用来处理UNICODE字符集的
是在没办法,才求你看看能换个函数实现不!
没什么修改还是老样子! sprintf 未定义!
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main--- 你的工程类型不对,在你工程属性中,把你的工程改为console
但是:
1,将 _ATL_MIN_CRT 删除
2,将 _wcsicmp 替换为 stricmp
3,将 wsprintf 替换为 wsprintfA会对程序什么地方有影响?希望能详细讲下!多谢啦!
1.最好还是建立正确的工程类型