Compile Wxwidgets without Unicode or wide character support

239 views Asked by At

I need to compile the wxWidgets 3.1.5 using Visual Studio 2005 without Unicode or wide character support, but only with old fashion char single byte (narrow character). Currently converting the code would take me too long.

I followed Gary's instructions at Non-Unicode/MBCS wxWidgets build for Visual Studio [How we solved it] below reported :

  1. Download and install wxWidgets and open the installation folder (named WXWIN from now on)
  2. Go to WXWIN\include\wx\msw\setup.h and change "wxUSE_UNICODE 1" to "wxUSE_UNICODE 0"
  3. Go to WXWIN\build\msw and open wx_vc16.sln (or the version of your choice)
  4. BEFORE batch building, highlight all projects in the solution > right-click > properties > Configuration Properties > Advanced and set "Character Set" to "Use Multi-Byte Character Set" for ALL CONFIGURATIONS
  5. Then go to C/C++ > Preprocessor > Preprocessor Definitions for EACH project and remove "_UNICODE" manually for ALL CONFIGURATIONS. Not all of the projects have this define set so you may have to select them in small groups or do them individually to ensure you remove it for all.
  6. You can then batch build as normal: go to Build > Batch Build and then "Select All" and then "Build"
  7. When you include wxWidgets, ensure your project is also set to non-Unicode

Step 5 was the route of our problems. Even though we defined wxUSE_UNICODE 0, it seems this macro merely changes the "overall" configuration for wxWidgets, and not the configuration for each sub-project/library. Further, the _UNICODE define seemingly overrode this option anyway, as visible in the code under "platform.h" which switches BOTH wxUSE_UNICODE and _UNICODE on if EITHER option is on.

but when I try to compile statbox.cpp in core dll I have

1>..\..\src\msw\statbox.cpp(534) : error C2664: 'GetThemeFont': error: cannot convert from 'LPLOGFONTW' to 'LOGFONT *'

how can I fix this issue ?

pre-processor settings:

WIN32
_USRDLL
DLL_EXPORTS
_CRT_SECURE_NO_DEPRECATE=1
_CRT_NON_CONFORMING_SWPRINTFS=1
_SCL_SECURE_NO_WARNINGS=1
__WXMSW__
NDEBUG
WXBUILDING
WXUSINGDLL
WXMAKINGDLL_CORE
wxUSE_BASE=0

And "Character Set" to "Use Multi-Byte Character Set"

0

There are 0 answers