开发者

error C2664 in VC++ 6.0 project to converted to visual C++ 2008

Function definition.

inline VARIANT_BOOL ISAXXMLReader::getFeature ( unsigned short * pwchName ) ; 

Calling it:

_bstr_t bstrFeature = featureName.c_str();
HRESULT hr = m_reader->getFeature(bstrFeature, &vfValue);

Compiler errirs:

error C2664: 'MSXML2::ISAXXMLReader::getFeature' : cannot convert parameter 1 
from '_bstr_t' to 'unsigned short *'
d:开发者_StackOverflow\formaanalyser_29_novixbrl_export_ct_600_negatelablel_word\formaanalyser\
xmlsupport\xmlparser.cpp    187

It is working fine in visual 6.0.


It is difficult to understand your question, but my guess is that it may be related to Unicode. VC++ 6.0 creates non-Unicode application by default, and VC++ 2008 creates Unicode application. This can cause different errors related to string pointer types. Try to change character set to Multibyte in VC++ 2008 project properties, General, Character Set.


Set Property Pages -> Configuration Parameters -> C/C++ -> language -> Treat WChar_t As Built-in Type -> No (Zc:wchar_t-)

This will fix the cannot convert parameter 1 from '_bstr_t' to 'unsigned short *' error


This has something to do with the fact that you are using an old version MSXML and multibyte strings. To resolve the issue set the "Tread Wchar_t as Built in Type" to "No (/Zc:wchar_t-)". This will solve your issue, but may break other interfaces, you may need to change it in other libraries too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜