windres cannot find "wx/msw/wx.rc" building wxWidgets project with MSYS2-minGW64 and Codelite

593 views Asked by At

Opening a new questions as some older answer does not apply to my case.

As per subject, I cannot compile a basic wxWidgets "Hello, World" program in Windows 10 with CodeLite 14 and wxWidgets 3.1.4 (compiled using MSYS2-mingW64).

The error message is at line

C:/Users/Federico/codelite/wxHelloWorld/win_resources.rc:1:10: fatal error: wx/msw/wx.rc: No such file or directory
    1 | #include "wx/msw/wx.rc"
      |          ^~~~~~~~~~~~~~
compilation terminated.

The resource file flags returned by wx-config running wx-config --rcflags are:

--use-temp-file --define __WXMSW__ --define _UNICODE --include-dir C:/wx/3.1.4-msys/lib/gcc_lib/mswu --include-dir C:/wx/3.1.4-msys/include

All folders/files are properly in place. By tinkering with these flags I found that no errors are given, and the program is properly compile, if I remove the --use-temp-file flag, like:

--define __WXMSW__ --define _UNICODE --include-dir C:/wx/3.1.4-msys/lib/gcc_lib/mswu --include-dir C:/wx/3.1.4-msys/include

Then everything works. Unfortunately, that flag is assumed by default by wx-config, so the only easy solution to not have it would be to just stop using wx-config and manually configure all compiler flags. So:

  • Is there any ways I could avoid this?
  • What is that flag meant for?
1

There are 1 answers

3
VZ. On BEST ANSWER

This is really strange because the use of --use-temp-file was removed from wx makefiles in the commit 093c3067e8 (Don't use windres --use-temp-file option, 2020-07-13) which is part of 3.1.4, so you shouldn't be seeing it at all.

But wait, it's even stranger, because wx-config doesn't have --rcflags option that you apparently use. It does have --rescomp option, but it has never included --use-temp-file in its output at all, AFAICS, and definitely not in 3.1.4.

So it looks like you're using something other than the official 3.1.4 version. And the answer to your first question is to use the official sources instead.