VS常见调试错误
1. ? ? ?不能從const char *(或者char數(shù)組)轉(zhuǎn)換為L(zhǎng)PCWSTR
a) ? ? ?解決: _T("TEST");
b) ? ? 原因:在UNICODE(寬字節(jié))字符集 typedef unsigned short wchar_t ,占2個(gè)字節(jié);ANSI ?char 占一個(gè)字節(jié);而系統(tǒng)默認(rèn)使用UNICODE字符集
c) ? ? ?參見(jiàn)http://blog.csdn.net/pirate97/article/details/6753763
2. ? ? ?無(wú)法解析的外部符號(hào) _main,該符號(hào)在函數(shù) ___tmainCRTStartup 中被引用
a) ? ? ?選擇“項(xiàng)目->屬性->配置屬性->鏈接器->系統(tǒng)”,將/subsystem:console改為/subsystem:windows
b) ? ? 控制臺(tái)程序,它的入口函數(shù)是main;windows程序的入口函數(shù)為winmain;
c) ? ? ?參見(jiàn)http://blog.csdn.net/ldd901/article/details/5795799
3. ? ? ?MessageBox的使用
a) ? ? ? 新建的類如果是繼承CWnd,或繼承其他窗口類、控件類,總之是CWnd的子類的話,可以使用MessageBox(_T("連接成功"))的形式即單個(gè)參數(shù);
b) ? ? ? ? ? ? ?其它情況,采用以下形式:
int MessageBox(
? HWND hWnd, ? ? ? ? ?// handle to owner window
? LPCTSTR lpText, ? ? // text in message box
? LPCTSTR lpCaption, ?// message box title
? UINT uType ? ? ? ? ?// message box style
);
---------------------?
作者:_北方的雪_?
來(lái)源:CSDN?
原文:https://blog.csdn.net/wingofeagle/article/details/9043425?
版權(quán)聲明:本文為博主原創(chuàng)文章,轉(zhuǎn)載請(qǐng)附上博文鏈接!
總結(jié)
- 上一篇: CString GetBuffer()
- 下一篇: ON_MESSAGE,ON_COMMAN