我在VC6.0中使用altbase.h編譯時出現
inline LPTSTR OLE2T(LPOLESTR lp) { return lp; }//出錯行
輸出資訊
atlconv.h(128) : error C2440: 'return' : cannot convert from 'unsigned short *' to 'char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
我重新建立一個工程,同樣使用VC6.0 ,只完成程式COM編程時用到的altbase.h的對應部分,卻不會報錯,且能正常運行!!各位大俠遇到過這種情況沒有,因為工程中的其他模塊很多,無法重新全部新建工程,況且這始終是個問題,剛開始用altbase.h中的內容,本來是想把用不到的定義屏蔽掉,呵呵,但是貌似是行不通的,請知道的大俠不吝賜教啊!謝謝~
uj5u.com熱心網友回復:
inline LPTSTR OLE2T(LPOLESTR lp) { return (LPTSTR)lp; }//出錯行uj5u.com熱心網友回復:
出錯提示行的背景關系是?uj5u.com熱心網友回復:
#include "atlconv.h "#if defined(_UNICODE)
// in these cases the default (TCHAR) is the same as OLECHAR
//.......
inline LPTSTR OLE2T(LPOLESTR lp) { return lp; }
#elif defined(OLE2ANSI)
// in these cases the default (TCHAR) is the same as OLECHAR
inline LPTSTR OLE2T(LPOLESTR lp) { return lp; }
#else
#define OLE2T(lpo) W2A(lpo)
#endif
uj5u.com熱心網友回復:
ALT F7看下設定 工程是unicode還是多位元組 設定不一樣 TCHAR位寬不一樣轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/61010.html
