I have as follows in my trackerFrame.h file.
It is included by trackerFrame.cpp and main.cpp and for whatever reason I am getting multiple definition problems from it when I try to compile all pertaining to the wxWidgets event table macros.
#ifndef TRACKER_H
#define TRACKER_H
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
# include "wx/wx.h"
#endif
#include <wx/frame.h>
#include <wx/string.h>
#include <wx/menu.h>
#include <iostream>
class mainFrame : public wxFrame {
public:
mainFrame(wxString title);
DECLARE_EVENT_TABLE()
private:
void closeProgram(wxCommandEvent & event);
};
BEGIN_EVENT_TABLE(mainFrame, wxFrame)
EVT_MENU(wxID_EXIT, mainFrame::closeProgram)
END_EVENT_TABLE()
#endif
I am 99.9% sure that I am doing the include guards properly and I just can’t figure out what is going on.
Your include guards are correct. The problem is most likely here:
According to the wxWidgets wiki on event tables, the event table needs to be defined into a
.cppfile. So you would have atracker.cppfile that includes thetracker.hfile and put theBEGIN_EVENT_TABLE(mainFrame, wxFrame) ...map into thetracker.cppfile.