Opened 5 years ago

Closed 5 years ago

#17033 closed build error (fixed)

Cannot build wxMSW library with UNICODE=0

Reported by: suzumizaki Owned by: vadz
Priority: normal Milestone:
Component: wxMSW Version: dev-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

wxMSW cannot be built when you set UNICODE=0 with current 'master' on GitHub(https://github.com/wxWidgets/wxWidgets/commit/903b2eb61a7fe2fa04f7e8a1baf41113b71b9000).

MSVC++ 2005 Express with SDK for Windows Server 2003 SP1 reports(Sorry as Japanese version, but you may know what the errors are):

..\..\src\msw\taskbarbutton.cpp(342) : error C2664: 'HRESULT (LPCTSTR,LPTSTR *)' : 2 番目の引数を 'LPWSTR *' から 'LPTSTR *' に変換できません。(新しい機能 ; ヘルプを参照)
        指示された型は関連がありません。変換には reinterpret_cast、C スタイル キャストまたは関数スタイルのキャストが必要です。
..\..\src\msw\taskbarbutton.cpp(342) : error C2664: 'HRESULT (LPCTSTR,LPTSTR *)' : 1 番目の引数を 'LPWSTR *' から 'LPCTSTR' に変換できません。(新しい機能 ; ヘルプを参照)
        指示された型は関連がありません。変換には reinterpret_cast、C スタイル キャストまたは関数スタイルのキャストが必要です。
..\..\src\msw\taskbarbutton.cpp(942) : error C2665: 'wxStrlcpy' : 2 オーバーロードのどれも、すべての引数の型を変換できませんでした
        Z:\wxmsw\include\wx/wxcrt.h(252): 'size_t wxStrlcpy(char *,const char *,size_t)' の可能性があります。
        Z:\wxmsw\include\wx/wxcrt.h(266): または 'size_t wxStrlcpy(wchar_t *,const wchar_t *,size_t)'
        引数リスト '(WCHAR [260], const char *, size_t)' を一致させようとしているとき
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\cl.EXE"' : 
Stop.

I think these errors will be reported any compilers on MS Windows, but I don't check with another ones.

Change History (3)

comment:1 Changed 5 years ago by suzumizaki

Also TDM-GCC reports:

g++ -c -o gcc_mswd\corelib_taskbarbutton.o -g -O0 -mthreads  -DHAVE_W32API_H -D__WXMSW__       -DwxUSE_UNICODE=0 -I..\..\lib\gcc_lib\mswd -I..\..\include  -W -Wall -DWXBUILDING -I..\..\src\tiff\libtiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zlib -I..\..\src\regex -I..\..\src\expat\lib -DwxUSE_BASE=0   -Wno-ctor-dtor-privacy   -MTgcc_mswd\corelib_taskbarbutton.o -MFgcc_mswd\corelib_taskbarbutton.o.d -MD -MP ../../src/msw/taskbarbutton.cpp
../../src/msw/taskbarbutton.cpp: In function 'HRESULT {anonymous}::InitPropVariantFromString(PCWSTR, {anonymous}::PROPVARIANT*)':
../../src/msw/taskbarbutton.cpp:342:52: error: cannot convert 'PCWSTR {aka const wchar_t*}' to 'LPCTSTR {aka const char*}' in argument passing
../../src/msw/taskbarbutton.cpp: In member function 'virtual bool wxTaskBarButtonImpl::AppendThumbBarButton(wxThumbBarButton*)':
../../src/msw/taskbarbutton.cpp:842:5: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
../../src/msw/taskbarbutton.cpp: In member function 'virtual bool wxTaskBarButtonImpl::AppendSeparatorInThumbBar()':
../../src/msw/taskbarbutton.cpp:852:5: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
../../src/msw/taskbarbutton.cpp: In member function 'virtual bool wxTaskBarButtonImpl::InsertThumbBarButton(size_t, wxThumbBarButton*)':
../../src/msw/taskbarbutton.cpp:870:5: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
../../src/msw/taskbarbutton.cpp: In member function 'bool wxTaskBarButtonImpl::InitOrUpdateThumbBarButtons()':
../../src/msw/taskbarbutton.cpp:922:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
../../src/msw/taskbarbutton.cpp:942:70: error: no matching function for call to 'wxStrlcpy(WCHAR [260], const char*, size_t)'
../../src/msw/taskbarbutton.cpp:942:70: note: candidates are:
In file included from ..\..\include/wx/hashmap.h:15:0,
                 from ..\..\include/wx/gdicmn.h:22,
                 from ..\..\include/wx/msw/gdiimage.h:19,
                 from ..\..\include/wx/msw/icon.h:18,
                 from ..\..\include/wx/icon.h:27,
                 from ../../src/msw/taskbarbutton.cpp:18:
..\..\include/wx/wxcrt.h:252:15: note: size_t wxStrlcpy(char*, const char*, size_t)
..\..\include/wx/wxcrt.h:252:15: note:   no known conversion for argument 1 from 'WCHAR [260] {aka wchar_t [260]}' to 'char*'
..\..\include/wx/wxcrt.h:266:15: note: size_t wxStrlcpy(wchar_t*, const wchar_t*, size_t)
..\..\include/wx/wxcrt.h:266:15: note:   no known conversion for argument 2 from 'const char*' to 'const wchar_t*'
mingw32-make: *** [gcc_mswd\corelib_taskbarbutton.o] Error 1

comment:2 Changed 5 years ago by vadz

  • Owner set to vadz
  • Status changed from new to accepted

comment:3 Changed 5 years ago by Vadim Zeitlin <vadim@…>

  • Resolution set to fixed
  • Status changed from accepted to closed

In 5ae3e4ff12215335c38b81e2161f91204cc6a6c1/git-wxWidgets:

Fix wxTaskBarButton code compilation in ANSI mode.

Correctly declare SHStrDupW() as always producing a wide char string on output
and pass a wide string to wxStrlcpy() using a wide char buffer.

Closes #17033.

Note: See TracTickets for help on using tickets.