On Thu, 2006-01-19 at 16:28 -0800, Greg Schussman wrote: > Questions: > 1) Have I done something exceptionally goofy or not in the spirit of > libsigc++? > 2) Why does the tutorial give the namespace "sigc", but I have to > use "SigC"?
You shouldn't have to use the SigC namespace, from what I understand it that is for backwards compatibility with sigc++ 1.2 > 3) Why does sigc++/sigc++.h #include sigc++/signal.h, but not sigc > ++/slot.h? I think slot.h is also for the backwards compatibility. In your example you should be using sigc::ptr_fun() rather than SigC::slot. > 4) Why the segfault? not sure, doesn't happen here, attaching revised example. Tim.
#include <iostream> #include <sigc++/sigc++.h> #include <sigc++/slot.h> using namespace std; void hello() { cout << "hello, " << flush; } void world() { cout << "world!" << endl; } int main() { // I wouldn't use signal as a variable name. sigc::signal<void> signal; signal.connect(sigc::ptr_fun(&hello)); signal.connect(sigc::ptr_fun(&world)); signal.emit(); // or just signal() cout << "Good night, Moon." << endl; }
_______________________________________________ libsigc-list mailing list libsigc-list@gnome.org http://mail.gnome.org/mailman/listinfo/libsigc-list