我正在使用wxWidgets 3.0.2和visual Studio 2015对于wxWidgets来说是一个新手。 由于包含的顺序和其他人因为unicodes而说某些错误,因此给出错误的原因是什么?所以我期待一个明确的答案。
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(38): error C2664: 'HWND CreateDialogParamW(HINSTANCE,LPCWSTR,HWND,DLGPROC,LPARAM)': cannot convert argument 2 from 'LPCTSTR' to 'LPCWSTR'
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(38): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast`
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(69): error C2664: 'HFONT CreateFontW(int,int,int,int,int,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,LPCWSTR)': cannot convert argument 14 from 'LPCTSTR' to 'LPCWSTR'
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(69): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(95): error C2664: 'HWND CreateWindowExW(DWORD,LPCWSTR,LPCWSTR,DWORD,int,int,int,int,HWND,HMENU,HINSTANCE,LPVOID)': cannot convert argument 2 from 'LPCTSTR' to 'LPCWSTR'
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(95): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(111): error C2664: 'HMENU LoadMenuW(HINSTANCE,LPCWSTR)': cannot convert argument 2 from 'LPCTSTR' to 'LPCWSTR'
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(111): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(311): error C2664: 'HICON LoadIconW(HINSTANCE,LPCWSTR)': cannot convert argument 2 from 'LPCTSTR' to 'LPCWSTR'
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(311): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(324): error C2664: 'HBITMAP LoadBitmapW(HINSTANCE,LPCWSTR)': cannot convert argument 2 from 'LPCTSTR' to 'LPCWSTR'
C:\wxWidgets-3.0.2\include\wx/msw/winundef.h(324): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
答案 0 :(得分:3)
您似乎正在使用wxUSE_UNICODE
和UNICODE
预处理程序符号值的错误组合编译代码。如果你展示了你正在编译的是什么(更小的例子,更好的)和你使用的编译器选项,那将是最好的。在没有这些信息的情况下,我只能说,如果你只是设置"字符集" to"使用Unicode"在"将军" IDE中项目选项对话框的页面,不做任何其他事情,所有内容都应该开箱即用,没有任何问题。
当然,如果您已经编辑了include/wx/msw/setup.h
文件,并且例如在那里更改了wxUSE_UNICODE
的值,则需要还原它。即请确保您使用未修改的 wxWidgets来源。
答案 1 :(得分:0)
正如here所讨论的,这是由于在Wx之前包含了一些Windows标头(除非如上所述,您确实对Unicode进行了修补)。 检查他们的订单,你应该会好的。