Hello,
This is somewhat frustrating to me, since I know I'm missing something obvious
I don't know how to phrase the question to find my own answer from google.
I have been working my way through every each zetcode wxwidgets tutorial
http://www.zetcode.com/tutorials/wxwidgetstutorial/widgets/ using C::B IDE and this is the first piece of sample code that has stopped me dead in my tracks.
I can get the code below to compile and execute just fine from a the terminal... but no luck from the IDE.
I know this is a stupid newbie issue... Is there an FAQ or something that someone can point me to.
#include "bitmapbutton.h"
BitmapButton::BitmapButton(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 130))
{
wxImage::AddHandler( new wxPNGHandler );
wxPanel *panel = new wxPanel(this);
slider = new wxSlider(panel, ID_SLIDER, 0, 0, 100,
wxPoint(10, 30), wxSize(140, -1));
button = new wxBitmapButton(panel, wxID_ANY, wxBitmap(wxT("mute.png"),
wxBITMAP_TYPE_PNG), wxPoint(180, 20));
Connect(ID_SLIDER, wxEVT_COMMAND_SLIDER_UPDATED,
wxScrollEventHandler(BitmapButton::OnScroll));
Center();
}
void BitmapButton::OnScroll(wxScrollEvent& event)
{
pos = slider->GetValue();
if (pos == 0) {
//button->SetBitmapLabel(wxBitmap(wxT("mute.png"), wxBITMAP_TYPE_PNG));
button->SetBitmapLabel(wxBitmap(wxT("/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/mute.png"), wxBITMAP_TYPE_PNG));
} else if (pos > 0 && pos <= 30 ) {
//button->SetBitmapLabel(wxBitmap(wxT("min.png"), wxBITMAP_TYPE_PNG));
button->SetBitmapLabel(wxBitmap(wxT("/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/min.png"), wxBITMAP_TYPE_PNG));
} else if (pos > 30 && pos < 80 ) {
//button->SetBitmapLabel(wxBitmap(wxT("med.png"), wxBITMAP_TYPE_PNG));
button->SetBitmapLabel(wxBitmap(wxT("/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/med.png"), wxBITMAP_TYPE_PNG));
} else {
//button->SetBitmapLabel(wxBitmap(wxT("max.png"), wxBITMAP_TYPE_PNG));
button->SetBitmapLabel(wxBitmap(wxT("/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/max.png"), wxBITMAP_TYPE_PNG));
}
}
As I said from the terminal prompt, everything works fine:
g++ main.cpp main.h bitmapbutton.cpp bitmapbutton.h `wx-config --cxxflags --libs` -Wall -o runthisjunk2
I thought I was having some type of dependency issue so I switched to an absolute path and I'm still having this issue.
Apparently I'm compiling ok... It has something to do with linking....
obj/Debug/bitmapbutton.o||In function `BitmapButton::OnScroll(wxScrollEvent&)':|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|26|undefined reference to `wxBitmap::wxBitmap(wxString const&, wxBitmapType)'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|26|undefined reference to `wxBitmap::~wxBitmap()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|26|undefined reference to `wxBitmap::~wxBitmap()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|29|undefined reference to `wxBitmap::wxBitmap(wxString const&, wxBitmapType)'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|29|undefined reference to `wxBitmap::~wxBitmap()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|29|undefined reference to `wxBitmap::~wxBitmap()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|32|undefined reference to `wxBitmap::wxBitmap(wxString const&, wxBitmapType)'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|32|undefined reference to `wxBitmap::~wxBitmap()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|32|undefined reference to `wxBitmap::~wxBitmap()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|35|undefined reference to `wxBitmap::wxBitmap(wxString const&, wxBitmapType)'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|35|undefined reference to `wxBitmap::~wxBitmap()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|35|undefined reference to `wxBitmap::~wxBitmap()'|
obj/Debug/bitmapbutton.o||In function `BitmapButton':|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|4|undefined reference to `wxFrameNameStr'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|4|undefined reference to `wxDefaultPosition'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|6|undefined reference to `wxImage::AddHandler(wxImageHandler*)'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|7|undefined reference to `wxPanelNameStr'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|7|undefined reference to `wxDefaultSize'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|7|undefined reference to `wxDefaultPosition'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|9|undefined reference to `wxSliderNameStr'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|9|undefined reference to `wxDefaultValidator'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxBitmap::wxBitmap(wxString const&, wxBitmapType)'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxButtonNameStr'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxDefaultValidator'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxDefaultSize'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxBitmap::~wxBitmap()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxBitmap::~wxBitmap()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|15|undefined reference to `wxEVT_COMMAND_SLIDER_UPDATED'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|17|undefined reference to `wxFrame::~wxFrame()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|4|undefined reference to `wxFrameNameStr'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|4|undefined reference to `wxDefaultPosition'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|6|undefined reference to `wxImage::AddHandler(wxImageHandler*)'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|7|undefined reference to `wxPanelNameStr'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|7|undefined reference to `wxDefaultSize'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|7|undefined reference to `wxDefaultPosition'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|9|undefined reference to `wxSliderNameStr'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|9|undefined reference to `wxDefaultValidator'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxBitmap::wxBitmap(wxString const&, wxBitmapType)'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxButtonNameStr'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxDefaultValidator'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxDefaultSize'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxBitmap::~wxBitmap()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|12|undefined reference to `wxBitmap::~wxBitmap()'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|15|undefined reference to `wxEVT_COMMAND_SLIDER_UPDATED'|
/home/jonas/projects/zetcode_tutorials/Widgets_I/wxBitmapButton/bitmapbutton.cpp|17|undefined reference to `wxFrame::~wxFrame()'|
obj/Debug/bitmapbutton.o||In function `wxStringBase::Init()':|
/usr/include/wx-2.8/wx/string.h|270|undefined reference to `wxEmptyString'|
obj/Debug/bitmapbutton.o||In function `wxObject':|
/usr/include/wx-2.8/wx/object.h|412|undefined reference to `vtable for wxObject'|
obj/Debug/bitmapbutton.o||In function `wxGDIObject':|
/usr/include/wx-2.8/wx/gdiobj.h|30|undefined reference to `vtable for wxGDIObject'|
obj/Debug/bitmapbutton.o||In function `wxBitmapBase':|
/usr/include/wx-2.8/wx/bitmap.h|119|undefined reference to `vtable for wxBitmapBase'|
obj/Debug/bitmapbutton.o||In function `wxBitmap':|
/usr/include/wx-2.8/wx/gtk/bitmap.h|53|undefined reference to `vtable for wxBitmap'|
obj/Debug/bitmapbutton.o||In function `~wxThreadHelperThread':|
/usr/include/wx-2.8/wx/thread.h|594|undefined reference to `wxThread::~wxThread()'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|