Compiler errors after #include <wx/wx.h>

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
mrek83nl
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Jun 25, 2020 10:06 am

Compiler errors after #include <wx/wx.h>

Post by mrek83nl » Thu Jun 25, 2020 11:48 am

I'm getting a lot of compile errors after #include <wx/wx.h> in my project. I have been trying to find a fix but without any luck. Anyone got a clue what this could cause and how to fix it.

Compiler output:
https://gist.github.com/mrek/e83cdec194 ... tfile1-txt

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Nov 03, 2006 2:00 pm

Re: Compiler errors after #include <wx/wx.h>

Post by stahta01 » Thu Jun 25, 2020 1:07 pm

Please list all the headers included before you included <wx/wx.h> ?

One of them likely is causing the problem!

NOTE: This is a common problem on MS Windows.

The main ones to cause the problems like this are:
commctrl.h use instead wx/msw/wrapcctl.h
commdlg.h use instead wx/msw/wrapcdlg.h
shlobj.h use instead wx/msw/wrapshl.h
winsock2.h use instead wx/msw/wrapwin.h
windows.h use instead wx/msw/wrapwin.h

Tim S.

mrek83nl
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Jun 25, 2020 10:06 am

Re: Compiler errors after #include <wx/wx.h>

Post by mrek83nl » Thu Jun 25, 2020 2:40 pm

Thanks Tim,
Your pointers gave me fuel to renew my search and it seemed that spdlog was part of the problem because they are inclusing <window.h>.
For anyone facing the same issue, see https://github.com/gabime/spdlog/issues/1589.

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Nov 03, 2006 2:00 pm

Re: Compiler errors after #include <wx/wx.h>

Post by stahta01 » Fri Jun 26, 2020 2:27 pm

Including "wx/msw/wrapwin.h" as the first include should fix your problem.

Tim S.

Post Reply