Author Topic: Problems with compiling GUI application created with wxSmith  (Read 2226 times)

Offline mmucha

  • Single posting newcomer
  • *
  • Posts: 2
Problems with compiling GUI application created with wxSmith
« on: February 14, 2023, 04:21:37 am »
Hi,
  Since some time I have a problem with compiling
all gui applications created with wxSmith.
I noticed this at the beginning of January.
I did the last wxWidgets project compilation which worked without any problem
in the beginning of October. It also worked with wxWidgets 3.17
Unfortunately I do not remember exactly what version of CB nightly I used and
what version of compiler.
Most probably it was CB_20221001_rev12932_win64.7z
I use msys2 gcc distribution and I am updating it frequently
so definitely it was already gcc 12.2.0 but I cannot tel which revision.

Currently I have installed
CB_20230212_rev13205_win64.7z
Compiler is the same although many updates (revisions) were made in the meantime
gcc (Rev10, Built by MSYS2 project) 12.2.0.
wxWidgets 3.21 compiled by me.
Windows 10 Pro 64 bit.

 
All projects using wxSmith created before October 2022 which compiled
and worked without any problem suddenly fail to compile with the latest versions
of CB and compiler. There is a lot of strange error messages concerning wxWidgets headers
and declarations contained in them.

The catch is that compilation of wxWidgets (3.21) itself and samples included with them
runs smoothly with the latest compiler. I use standard makefiles (mekefile.gcc)
No problems with headers at all.

So the conjecture is that something is wrong with configuration of CB or wxSmith
which I cannot find. Or maybe something in wxSmith and resource handling?
I would appreciate any hint indicating what might be wrong.
 

I created a simple new project (which I include with compiler and messages logs)
using nightly CB_20230129_rev13166_win64.
It fails to compile (also with latest nightly) with the same error messages as the other older projects.

Regards
Michal Mucha

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1591
Re: Problems with compiling GUI application created with wxSmith
« Reply #1 on: February 14, 2023, 10:14:45 am »
You should clean a bit the include search directories. I do not know about the msys includes, but some from wxWidgets should be removed:
Code
C:\wxWidgets\include
C:\wxWidgets\lib\gcc_dll\mswu
C:\msys\mingw64\include
C:\wxWidgets\include\wx  <- remove
C:\wxWidgets\include\wx\msw  <- remove
C:\msys\mingw64\lib
C:\msys\mingw64\x86_64-w64-mingw32\include
C:\msys\mingw64\x86_64-w64-mingw32
C:\wxWidgets\include  <- remove
C:\wxWidgets\lib\gcc_dll  <- remove

Offline mmucha

  • Single posting newcomer
  • *
  • Posts: 2
Re: Problems with compiling GUI application created with wxSmith
« Reply #2 on: February 16, 2023, 04:20:00 am »
Hi,
   Thank you for your prompt reply.
Now everything is working.
I cleaned compiler search paths as you advised
but it did not solve the problem completely.
I had to do one other thing.

Once I cleaned the paths compilation stopped at
processing \c:\wxWidgets\include\wx\platform.h
where at line 159 there is directive
#include "wx/setup.h"

It turns out that this file is not there under
standard wxWidgets installation on Windows.

It is either in
c:\wxWidgets\include\wx\msw\
(compiler follows the include directive literally and does not
search subdirectories)
or
c:\wxWidgets\lib\gcc_dll\mswu\wx\
or
c:\wxWidgets\lib\gcc_lib\mswu\wx\
where the wxWidgets makefile copies them

Three copies of the same file but none of them
in the right place.
That is why I included these directories in
compiler search path. It turned out it caused the
mess.

As I noticed, after your reply, some hint as to file
locations can be found in the file under meaning full name
c:\wxWidgets\include\wx\setup_redirect.h
which I paste below:
------------
/*
 * wx/setup.h
 *
 * This file should not normally be used, except where makefiles
 * have not yet been adjusted to take into account of the new scheme
 * whereby a setup.h is created under the lib directory.
 *
 * Copyright:   (c) Vadim Zeitlin
 * Licence:     wxWindows Licence
 */

#ifdef __WXMSW__
#include "wx/msw/setup.h"
#else
#error Please adjust your include path to pick up the wx/setup.h file under lib first.
#endif
----------
Evidently the wxWidgets own makefiles have been adjusted but not
all applications using wxWidgets "know" about the adjustment.
I wonder what is the rationale for such solution.
It looks like that the platform.h file could/should be adjusted with something like
this
#ifdef __WXMSW__
#include "wx/msw/setup.h"
#else
#include "wx/setup.h"
#endif

Another simple solution is copying the Windows version of
setup.h to
c:\wxWidgets\include\wx\
(where it is expected to be) and cleaning search path as you suggested.

Thank you once again for your help.

Regards

Michal Mucha


Offline sodev

  • Regular
  • ***
  • Posts: 498
Re: Problems with compiling GUI application created with wxSmith
« Reply #3 on: February 20, 2023, 06:51:38 pm »
Short answer: NO

Long answer:
All these setup.h files you found are NOT the same. These files contain the build settings of the library variant (plus the default file that fills missing information not defined by the variant), you can have multiple variants available. The correct way is, like mentioned in the file which contents you posted, to add the library directory FIRST on the include path. This way the variant specific file has the highest priority and gets used first.