2016-09-06 14 views
-1

wxWidgets 3.0.2とVisual Studio 2015はwxWidgetsの新機能です。 与えられたエラーの理由のいくつかは、インクルードの順序とユニコードのために他の人が言っているという理由からです。だから明確な答えを期待している。エラーC2664: 'HWNDは引数2を' lpctstr 'から' lpcwstr 'に変換できません。Visual Studio 2015

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 
+1

ワイド文字列ポインタが必要な関数にASCII文字列ポインタを渡そうとしているようです。 – Michael

+0

@マイケル:通常、これらの種類のエラーが発生する理由は、私はそれが一般的なエラーですが、明確な答えではないことがGoogle検索しました – leox

+0

これはあなたが書かれたコードの場合は、これが他人によって書かれたコードの場合は、ライブラリがUnicodeを使用するように設定するか、Unicodeをサポートしないでコンパイルするようにプロジェクトを設定する方法を見つけてください。 – Michael

答えて

1

あなたはwxUSE_UNICODEUNICODEプリプロセッサシンボル値の間違ったミックスを使用してコードをコンパイルしているようです。あなたがコンパイルしているもの(より小さい例、より良いもの)と使用するコンパイラオプションを示したなら、それが最も良いでしょう。この情報がなければ、IDEのプロジェクトオプションダイアログの「一般」ページで「文字セット」を「Unicodeを使用」に設定して何もしないと、問題なくコンパイルしてください。

もちろん、すでにinclude/wx/msw/setup.hファイルを編集していて、たとえばwxUSE_UNICODEの値を変更した場合は、元に戻す必要があります。私。 を修正していない wxWidgetsソースを使用してください。

+0

UNICODEと_UNICODEがプロジェクトで有効になっている場合、LPCTSTRはLPCWSTRと同等になります。だからもし私がLoadStringW()をwinuser.hで呼び出すと、LPCWSTRが期待されます。だからとにかく私はLPCTSTRを渡すことができ、LPCWSTRに暗黙的に変換されます。 – leox

+0

また、私はsetup.hに変更を加えなかった – leox

+0

はい。 'UNICODE'が定義されていれば、' wxUSE_UNICODE'は明示的に0として定義されていますが、 'LPCTSTR'と' LPCWSTR'が異なるためにエラーが発生します。それを見つけてそれを取り除く。あなたが編集したコードを一度も見たことがないので、もっと言い表すのは本当に不可能です! –

関連する問題