I am running a wxWidgets program using Visual Studio, it was all running fine before I made some changes and added an inclusion of <wx/gauge.h> which suddenly broke the build. Even after removing said line and all the changes, there would still be more than 600+ errors that don’t really mean anything to me, since they are likely coming from the includes.
I tried creating a new project and running a base wxWidgets up which worked with no errors. So the issue must be in my code and/or includes.
Here are the includes for all of the files:
MSTFrame.cpp
#include "MSTFrame.h"
#include "ProcessFns.h"
#include <sstream>
#include <Windows.h>
#include <wx/wx.h>
#include <wx/spinctrl.h>
MainFrame.cpp
#include "MainFrame.h"
#include "ProcessFns.h"
#include "MSTFrame.h"
#include <Psapi.h>
#include "WinBase.h"
#include <Windows.h>
#include <wx/wx.h>
ProcessFns.cpp
#include <string>
#include <Windows.h>
The header files have no includes.
Here are some errors that are being listed:
'Blink': unknown override specifier
'Count': unknown override specifier
Error C2182 '__addgsqword': this use of 'void' is not valid MemoTools C:Program Files (x86)Windows Kits10Include10.0.22621.0umwinnt.h
Error C2182 '__addgsbyte': this use of 'void' is not valid MemoTools C:Program Files (x86)WindowsKits10Include10.0.22621.0umwinnt.h
Error C2039 'wstring': is not a member of 'std'
Error C3646 'WINAPI': unknown override specifier
Error C3646 'WorkingSetInfo': unknown override specifier MemoTools C:Program Files (x86)Windows Kits10Include10.0.22621.0umPsapi.h
Error C3646 'VirtualAddress': unknown override specifier MemoTools C:Program Files (x86)Windows Kits10Include10.0.22621.0umPsapi.h 437
About 10 lines of the output:
1>App.cpp error C2504: 'wxApp': base class undefined
1>(compiling source file 'App.cpp')
1>MainFrame.h(3,29): error C2504: 'wxFrame': base class undefined
1>(compiling source file 'App.cpp')
1>MainFrame.h(7,14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'App.cpp')
1>MainFrame.h(7,29): error C2143: syntax error: missing ',' before '&'
1>(compiling source file 'App.cpp')
1>MainFrame.h(8,25): error C2061: syntax error: identifier 'wxArrayString'
1>(compiling source file 'App.cpp')
Any help will be greatly appreciated.
2
Answers
UPDATE: This has been resolved mostly by accident on my part.
I moved the placement of the header and includes around until there were no conflicts. Moving the header includes to the bottom with wx at the top and moving the Windows header around (the window header is always a pain), seems to have worked.
What I mostly learned from this is that I need to learn more about includes. Thanks to everyone who commented and suggested ideas.
If you want your answer accepted for this if you contributed, please post one so I may accept it.
You’re mixing up IntelliSense errors and build errors, which are completely different. The cause of your build errors is quite obvious: your
App.cpp
doesn’t includewx/app.h
, sowxApp
is not defined in it and yourMainFrame.h
doesn’t includewx/frame.h
, sowxFrame
is not defined there. To solve these errors you just need to include the missing headers.IntelliSense errors may be due to this too or to something else but in any case you need to make your code build first before caring about IntelliSense.