GTKmm and SigC
I just started learning GTKmm (using Qt right now; just trying this toolkit out ;) ), and I ran into some problems. I tried to compile the example from gtkmm.org's tutorial, but apparently there is something going on with sigc++ 2.0. I'm using Mandrake 10.1 and installed all the appropriate libsigc++ libraries, including the development ones.
Here is the problem. Take this code for example: Code:
Gtk::Button m_button1("Quit"); Any ideas on how to fix this? Thanks in advance! |
I'm just starting to use GTKmm a bit myself, but the code as you listed it should be the correct way to call sigc::mem_fun. Do you have the right headers included? Was the original error a compiler error or linker error? Perhaps you forgot to include the sigc library? Did you use pkg-config to get the cflags and libs?
(e.g. g++ -o file somefile.cpp `pkg-config gtkmm-2.4 --libs --cflags`) |
I've got the sigc++ 2.0 library and I'm using a compile command similar to yours including the pkconfig bit. The original error was a compile error. This is the output from g++ after I attempt to compile a sample file:
Code:
g++ hello.cpp -o hello `pkg-config gtkmm-2.0 --cflags --libs` Code:
#include <gtkmm.h> |
I get a different error when trying to compile your code:
Code:
$ g++ -o hello hello.cpp `pkg-config gtkmm-2.4 --cflags --libs` Code:
b.signal_clicked().connect(sigc::ptr_fun(slot_x)); What is the output of pkgconfig gtkmm-2.0 --cflags? Mine is as follows: Code:
$ pkg-config gtkmm-2.4 --cflags |
Apparently, I upgraded to gtkmm-2.4 and that solved everything. :) I also changed mem_fun to ptr_fun like you said and that took care of the compile error. Thanks for all the help!
|
All times are GMT -5. The time now is 02:37 AM. |