0

I am trying to compile wxWidgets 3.2.2.1 using MinGW that came in with Code::Blocks.

I used the following settings for compiling (which is also the same in the config.gcc file)

mingw32-make.exe -f makefile.gcc USE_XRC=1 SHARED=0 MONOLITHIC=0 BUILD=release UNICODE=0

At the end of the compilation, I get this error message:

../../src/msw/main.cpp: In function 'int wxEntry()':
../../src/msw/main.cpp:359:72: error: no matching function for call to 'wxEntry(int&, wchar_t**)'
     return wxEntry(wxMSWCommandLineGetArgc(), wxMSWCommandLineGetArgv());
                                                                        ^
../../src/msw/main.cpp:182:5: note: candidate: 'int wxEntry(int&, wxChar**)'
 int wxEntry(int& argc, wxChar **argv)
     ^~~~~~~
../../src/msw/main.cpp:182:5: note:   no known conversion for argument 2 from 'wchar_t**' to 'wxChar**' {aka 'char**'}
../../src/msw/main.cpp:355:5: note: candidate: 'int wxEntry()'
 int wxEntry()
     ^~~~~~~
../../src/msw/main.cpp:355:5: note:   **candidate expects 0 arguments, 2 provided**
mingw32-make.exe: *** [makefile.gcc:12809: gcc_msw\baselib_main.o] Error 1

I don't think there's anything wrong with my compiler because I tried building and running simple C and C++ codes in Code::Blocks without any problem. Now I want to create a wxWidgets project.

I tried downloading the wxWidgets installation file again and recompiled it but I still got the same error.

Any help will be greatly appreciated. Thanks.

fredv
  • 1
  • 2
  • 1
    Looks to me like `UNICODE=0` is no longer supported since [this commit](https://github.com/wxWidgets/wxWidgets/commit/d979a7f0d8214e1a992bc5e7aced48d024ea2561), because `wxMSWCommandLineGetArgv` has `wchar_t**` instead of `wxChar**` as return type. – ssbssa May 03 '23 at 10:34
  • 1
    @fredv, UNICODE option has to be set to 1. – Igor May 03 '23 at 11:15
  • @ssbssa, and igor. Thanks for your comments. The compilation options are very confusing specially to a newbie like me. I have searched the internet for instructions/tips on how to do it properly and I've read so many conflicting opinions (probably because many of them are outdated). I will try again and stick with the options that are contained in the config.gcc. Thanks again for your help. – fredv May 03 '23 at 14:41
  • @fredv, do not try and search/google. The official documentation should be one AND ONLY option to work with something open-source. – Igor May 03 '23 at 19:59
  • 1
    Is there any reason you're building wxWidgets yourself, and not downloading a prebuilt one from [MSYS2](https://stackoverflow.com/q/30069830/2752075)? – HolyBlackCat May 04 '23 at 19:09

1 Answers1

1

The build without Unicode support has indeed got inadvertently broken in 3.2.2, thanks to @ssbssa for noticing this. It will be fixed in 3.2.3 (and is already fixed in the latest 3.2 branch), but for now please use the default and recommended compilation options, i.e. just do mingw32-make.exe -f makefile.gcc BUILD=release to build the release versions of the libraries (although if you're planning on debugging your application, omitting BUILD=release would be a good idea).

In particular, please do not use UNICODE=0 unless you really need to do it, i.e. are working with some very old legacy code which doesn't compile with the default UNICODE=1. Note that support for UNICODE=0 is officially deprecated since many years and will be dropped completely in the next wxWidgets version.

VZ.
  • 21,740
  • 3
  • 39
  • 42
  • Thanks for the suggestion. I did a fresh installation of code::blocks with MinGW, unzip wxWidgets and compiled it as per your instructions without encountering any error (:D). However, when I tried to create a wxWidgets/wxSmith project, I got more than 50 errors. One set of errors was in imagjpeg.cpp - "undefined reference to 'jpeg_(something)'" and another set in imagtiff.cpp - "undefined reference to 'TIFF(something)'". I suspect they are linking errors and that I should be adding a file or two in my Link Library but I don't know how to determine which files. Any help will be appreciated. – fredv May 04 '23 at 14:13
  • You need to link with jpeg and tiff (and other) libraries that were created as part of the build. You can try compiling the minimal sample to see the linker command line including all of them. – VZ. May 04 '23 at 16:05