Re: [sigc] sigc::trackable inaccessible base error



Rupert Swarbrick wrote:

I've seen various "inaccessible base errors" in searching on Google, but
I couldn't quite find this one and I don't understand quite what's going on.

I have a class, FileEntry (which consists of an entry widget and a
button that spawns a file selection dialog from Gtkmm):

class FileEntry : protected Gtk::HBox
{
public:
 FileEntry(bool open=true,
           std::string defaultname="");
protected:
 void on_button();
 ...stuff...
};

(Note that it inherits from _protected_ HBox)

Now, in FileEntry::FileEntry, I need to connect the button clicked event
for said button to a handler. Thus I create the slot with this line:

sigc::slot<void> sl = sigc::mem_fun(*this, &FileEntry::on_button);

Sadly, I now get these g++ error:

/usr/include/sigc++-2.0/sigc++/type_traits.h: In instantiation of 'const
bool sigc::is_base_and_derived<sigc::trackable, rjs::FileEntry>::value':
/usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:1792:   instantiated
from 'sigc::bound_mem_functor0<void, rjs::FileEntry>'
FileEntry.cc:11:   instantiated from here
/usr/include/sigc++-2.0/sigc++/type_traits.h:132: error:
'sigc::trackable' is an inaccessible base of 'rjs::FileEntry'

Now then, I can compile happily by inheriting from public Gtk::HBox, but
this really doesn't seem like it should be necessary - surely as we're
in the constructor the public/private/whatever should make no difference?

I'd really like to know what the heck's going on here - does mem_fun do
something very wierd?
Please, consider my answer like a guess.

"sigc::mem_fun" is a wrapper that construct sigc::slot object. Last one should have public access to your object sigc::trackable destructor to disconnect slot/signals when your object destroyed. Probably, you better do investigate source codes either documentation files for more information.

Regards,
-andrew




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]