Erreur de compilation gtkmm 3.0
Bonjour,
j'essaie de compiler un exemple provenant de la documentation développeur de GNOME https://developer.gnome.org/gtkmm-tu...uttons.html.fr
buttons.h
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| #ifndef GTKMM_EXAMPLE_BUTTONS_H
#define GTKMM_EXAMPLE_BUTTONS_H
#include <gtkmm/window.h>
#include <gtkmm/button.h>
class Buttons : public Gtk::Window
{
public:
Buttons();
virtual ~Buttons();
protected:
//Signal handlers:
void on_button_clicked();
//Child widgets:
Gtk::Button m_button;
};
#endif //GTKMM_EXAMPLE_BUTTONS_H |
buttons.cc
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| #include "buttons.h"
#include <iostream>
Buttons::Buttons()
{
m_button.add_pixlabel("info.xpm", "cool button");
set_title("Pixmap'd buttons!");
set_border_width(10);
m_button.signal_clicked().connect( sigc::mem_fun(*this,
&Buttons::on_button_clicked) );
add(m_button);
show_all_children();
}
Buttons::~Buttons()
{
}
void Buttons::on_button_clicked()
{
std::cout << "The Button was clicked." << std::endl;
} |
main.cc
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| #include "buttons.h"
#include <gtkmm/main.h>
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
Buttons buttons;
//Shows the window and returns when it is closed.
Gtk::Main::run(buttons);
return 0;
} |
cependant j'obtiens ce message d'erreur :
Code:
1 2 3 4 5
| /tmp/ccjv3wrJ.o: In function `main':
main.cc:(.text+0x43): undefined reference to `Buttons::Buttons()'
main.cc:(.text+0x66): undefined reference to `Buttons::~Buttons()'
main.cc:(.text+0x88): undefined reference to `Buttons::~Buttons()'
collect2: error: ld returned 1 exit status |
pour compiler j'utilise la commande suivante :
Code:
g++ main.cc -o main `pkg-config gtkmm-3.0 --cflags --libs`
Si quelqu'un peut m'aider.