0
這是一個新手的問題: 當我創建了一個wxWidgets的框架項目,在我需要的功能添加#這一點,我有這樣的編譯器錯誤:C:與wxWidgets的B項目的編譯器的問題
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h||In function 'HWND__* CreateDialog(HINSTANCE, LPCTSTR, HWND, DLGPROC)':|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h|39|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateDialogParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM)'|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h||In function 'HFONT__* CreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR)':|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h|70|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '14' to 'HFONT__* CreateFontW(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCWSTR)'|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h||In function 'HWND__* CreateWindow(LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)':|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h|95|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)'|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h||In function 'HMENU__* LoadMenu(HINSTANCE, LPCTSTR)':|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h|112|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HMENU__* LoadMenuW(HINSTANCE, LPCWSTR)'|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h||In function 'HWND__* FindText(LPFINDREPLACE)':|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h|127|error: cannot convert 'LPFINDREPLACE {aka FINDREPLACEA*}' to 'LPFINDREPLACEW {aka FINDREPLACEW*}' for argument '1' to 'HWND__* FindTextW(LPFINDREPLACEW)'|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h||In function 'HICON__* LoadIcon(HINSTANCE, LPCTSTR)':|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h|312|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HICON__* LoadIconW(HINSTANCE, LPCWSTR)'|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h||In function 'HBITMAP__* LoadBitmap(HINSTANCE, LPCTSTR)':|
C:\wxWidgets-2.9.4\include\wx\msw\winundef.h|325|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HBITMAP__* LoadBitmapW(HINSTANCE, LPCWSTR)'|
P:\c++\codeblocks\UDP SOCKET COM\Communication.cpp||In function 'void ConnectUDP()':|
P:\c++\codeblocks\UDP SOCKET COM\Communication.cpp|7|warning: unused variable 's' [-Wunused-variable]|
||=== Build finished: 7 errors, 1 warnings (0 minutes, 1 seconds) ===|
這裏是代碼:
#include <winsock2.h>
#include <wx/msgdlg.h>
#include <wx/string.h>
void ConnectUDP(){
SOCKET s;
int result;
WSADATA wsaData;
//initialize winsock
result = WSAStartup(MAKEWORD(2,2), &wsaData);
if(result != NO_ERROR){
wxMessageBox("WSAStartup failed with error: " + wxString::Format(wxT("%i"),result));
}
}
這隻發生在C:將b,我沒有與wxdev或vs2015問題
好吧,編譯器說「char不是wchar_t」,這應該不會令人驚訝。可能有'TCHAR'不匹配,提取一個最小的例子。 –
有沒有我可以在編譯器端做的任何修復?我仍然想留在c:b。謝謝。 – Jacob
首先,瞭解'TCHAR'可以做什麼不同的事情。其次,這個問題不在IDE中。它甚至沒有編譯器!相反,這是源代碼中的一個問題,它應該是微不足道的修復。 –