-----Original Message-----
From: Murray Cumming [mailto:murrayc murrayc com]
Sent: Friday, July 02, 2004 2:25 PM
To: Miller, Ryan D
Cc: gtkmm-list
Subject: Re: [gtkmm] Using classes derived from gtk
On Fri, 2004-07-02 at 12:03 -0400, Miller, Ryan D wrote:
> /usr/include/c++/3.3.3/bits/stl_alloc.h:656: undefined reference to
> 'VTT for browserTree'
I guess that this has some different cause.
---
Apparently so
---
> this->set_model also gives me the same error
TreeView::set_model(whatever) is that you would do if you really wanted to specify a method in a certain class.
---
Gives me the same error :(
---
> Is there something special I need to do, or am I missing something
> basic? (I'll attach the code if needed)
>
> It might be worth mentioning I'm using glade
I think you mean "glademm" which generates code. You might want to consider libglademm if you don't know about it already.
--
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com
---
This is a prototype so the goal is quick development so I choose to use glade to design and glademm to generate the code. Libglademm seemed more complex and the UI won't be dynamic anyway.
Here's some stripped down code that might help:
---// browserTree_glade.hh> // ---
#include <gtkmm/treeview.h>
class browserTree_glade : public Gtk::TreeView
{
public:
class Gtk::TreeView * browserTree;
protected:
browserTree_glade(GlademmData *gmm_data);
~browserTree_glade();
private:
virtual void on_treeview1_row_collapsed(const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path) = 0;
virtual void on_treeview1_row_expanded(const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path) = 0;
virtual void on_treeview1_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column) = 0;
};
---------------
---// browserTree_glade.cc> // ---
#include "browserTree_glade.hh"
browserTree_glade::browserTree_glade(GlademmData *gmm_data
)
{ browserTree = this;
browserTree->set_flags(Gtk::CAN_FOCUS);
browserTree->set_headers_visible(true);
...
}
---------------
---// browserTree.hh> // ---
#include "browserTree_glade.hh"
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
Gtk::TreeModelColumn<Glib::ustring> name; // name of the file
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > pic; // icon for the file
Gtk::TreeModelColumn<Glib::ustring> relPath; // the realitive path from the fp directory
ModelColumns() { add(name); add(pic); add(relPath);}
};
class browserTree : public browserTree_glade
{
public:
std::string fp; // the root file path for the tree to browse
browserTree(GlademmData *gmm_data);
~browserTree();
...
protected:
ModelColumns myColumns;
Glib::RefPtr<Gtk::TreeStore> refTreeModel;
...
};
---------------
---// browserTree.cc> // ---
#include "browserTree.hh"
using namespace std;
browserTree::browserTree(GlademmData *gmm_data) : browserTree_glade(gmm_data)
{
fp = string("/home/millerr/Build/");
refTreeModel = Gtk::TreeStore::create(myColumns);
// **NOT SURE WHAT TO DO TO FIX THIS TYPE OF CALL??** //
Gtk::TreeView::set_model(refTreeModel);
...
}
BREAKS WITH ERRORS:
/./obj/browserTree.o(.text+0x554): In function `browserTree::browserTree[in-charge](GlademmData*)':
src/browserTree.cc:20: undefined reference to `VTT for browserTree'
./obj/browserTree.o(.text+0x56b):src/browserTree.cc:20: undefined reference to `VTT for browserTree'
./obj/browserTree.o(.text+0x92f): In function `browserTree::browserTree[in-charge](GlademmData*)':
/usr/include/c++/3.3.3/bits/stl_alloc.h:656: undefined reference to `VTT for browserTree'
./obj/browserTree.o(.text+0x940):/usr/include/c++/3.3.3/bits/stl_alloc.h:656: undefined reference to `VTT for browserTree'
----------
Thanks again,
Ryan