943,838 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 1697
  • C++ RSS
Apr 7th, 2009
0

Event Table problem(wxWidgets)

Expand Post »
When I declare an event table in a class a.k.a DECLARE_EVENT_TABLE(); then try to compile, i always get this error:
[Linker Error] undefined reference to `vtable for Utility' (utility being my class) What does this mean and how do I fix it? All research on this has turned up dead ends =(. Thanks
Last edited by clutchkiller; Apr 7th, 2009 at 11:38 pm.
Reputation Points: 23
Solved Threads: 3
Junior Poster
clutchkiller is offline Offline
181 posts
since Jul 2008
Apr 8th, 2009
0

Re: Event Table problem(wxWidgets)

Presumably something needs to be declared as virtual in Utility. Without code, it's hard to say exactly what.
Reputation Points: 163
Solved Threads: 91
Posting Pro in Training
nucleon is offline Offline
476 posts
since Oct 2008
Apr 8th, 2009
0

Re: Event Table problem(wxWidgets)

Here is my Header file:

c++ Syntax (Toggle Plain Text)
  1. #ifndef UTILITY_H
  2. #define UTILITY_H
  3.  
  4. #include <wx/wx.h>
  5.  
  6. enum
  7. {
  8. btn_send = 100,
  9. btn_main,
  10. im_box_rec,
  11. im_box_ent,
  12. im_box_con,
  13. im_box_addip,
  14. im_combo
  15. };
  16.  
  17. class Utility : public wxFrame
  18. {
  19. public:
  20. Utility(const wxString &title, const wxPoint &pos, const wxSize &size);
  21.  
  22. private:
  23. DECLARE_EVENT_TABLE();
  24.  
  25. };
  26.  
  27. #endif

And here is my .cpp:

c++ Syntax (Toggle Plain Text)
  1. #include "Utility.h"
  2. #include <wx/wx.h>
  3.  
  4. Utility::Utility(const wxString &title, const wxPoint &pos, const wxSize &size) : wxFrame(NULL, -1, title, pos, size)
  5. {
  6. /////////////////////////MENU////////////////////////////////
  7.  
  8.  
  9. wxMenu *util_list = new wxMenu;
  10.  
  11. util_list -> Append(-1, _T("&"));
  12. util_list -> Append(-1, _T("&"));
  13. util_list -> Append(-1, _T("&"));
  14. util_list -> AppendSeparator();
  15. util_list -> Append(-1, _T("&About"));
  16. util_list -> AppendSeparator();
  17. util_list -> Append(-1, _T("E&xit"));
  18.  
  19. wxMenuBar *MENU = new wxMenuBar;
  20.  
  21. MENU -> Append(util_list, _T("&Utilities"));
  22.  
  23. SetMenuBar(MENU);
  24.  
  25. ///////////////////////PANELS/////////////////////////////
  26.  
  27. wxPanel *mainPanel = new wxPanel(this, -1, wxPoint(0,0), wxSize(1000,600), wxBORDER_STATIC);
  28. wxPanel *sideWin = new wxPanel(mainPanel, -1, wxPoint(800,0), wxSize(200,500), wxBORDER_STATIC);
  29.  
  30. wxTextCtrl *imBox_rec = new wxTextCtrl(mainPanel, im_box_rec, _T("Recieve text..."), wxPoint(0, 50), wxSize(400,200));
  31. wxTextCtrl *imBox_ent = new wxTextCtrl(mainPanel, im_box_ent, _T("Enter text..."), wxPoint(0,300), wxSize(400,100));
  32.  
  33. wxComboBox *imCombo = new wxComboBox(mainPanel, im_combo, _T("IP List"), wxPoint(100, 25), wxSize(152, 100));
  34.  
  35. wxButton *saveTran = new wxButton(mainPanel, -1, _T("Save Transcript"), wxPoint(0, 252), wxSize(400, 20));
  36. wxButton *addipButton = new wxButton(mainPanel, im_box_addip, _T("Add IP"), wxPoint(100,0), wxSize(150,25));
  37. wxButton *conButton = new wxButton(mainPanel, im_box_con, _T("Connect to IP"), wxPoint(0,0), wxSize(100,50));
  38. wxButton *mainButton = new wxButton(mainPanel, btn_main, _T("entr"), wxPoint(300,60), wxSize(100,100));
  39. wxButton *sendButton = new wxButton(mainPanel, btn_send, _T("Send"), wxPoint(0,400), wxSize(400,50));
  40.  
  41. wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
  42.  
  43. mainSizer -> Add(imBox_rec, 0, wxCENTER, 0);
  44. mainSizer -> Add(imBox_ent, 0, wxCENTER, 0);
  45. mainSizer -> Add(mainButton, 0, wxCENTER, 0);
  46. mainSizer -> Add(sendButton, 0, wxCENTER, 0);
  47.  
  48. //mainPanel -> SetAutoLayout(true);
  49. //mainPanel -> SetSizer(mainSizer);
  50.  
  51. }
Reputation Points: 23
Solved Threads: 3
Junior Poster
clutchkiller is offline Offline
181 posts
since Jul 2008
Apr 8th, 2009
0

Re: Event Table problem(wxWidgets)

I don't know wxWidgets, so I'm just guessing here. Try making DECLARE_EVENT_TABLE(); public instead of private.

If that doesn't work, try putting this in your code:
C++ Syntax (Toggle Plain Text)
  1. BEGIN_EVENT_TABLE(MyFrame, wxFrame)
  2. END_EVENT_TABLE()

Or, if you aren't goint to have any events, remove DECLARE_EVENT_TABLE(); altogether.
Reputation Points: 163
Solved Threads: 91
Posting Pro in Training
nucleon is offline Offline
476 posts
since Oct 2008
Apr 8th, 2009
0

Re: Event Table problem(wxWidgets)

Click to Expand / Collapse  Quote originally posted by nucleon ...
Try making DECLARE_EVENT_TABLE(); public instead of private.
Nah, don't do that, it's good as is. However this:

Click to Expand / Collapse  Quote originally posted by nucleon ...
try putting this in your code:
C++ Syntax (Toggle Plain Text)
  1. BEGIN_EVENT_TABLE(MyFrame, wxFrame)
  2. END_EVENT_TABLE()

Or, if you aren't goint to have any events, remove DECLARE_EVENT_TABLE(); altogether.
is indeed the answer to your problem.
Last edited by Nick Evan; Apr 8th, 2009 at 4:32 am.
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006
Apr 8th, 2009
0

Re: Event Table problem(wxWidgets)

Thanks, that solved it =D
Reputation Points: 23
Solved Threads: 3
Junior Poster
clutchkiller is offline Offline
181 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: simple C++ inheritance program not working.
Next Thread in C++ Forum Timeline: Deleting a node from a linked list





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC