# pkg-config --cflags gtkmm-3.0 |xargs -n1
# pkg-config --libs gtkmm-3.0 |xargs -n2
然后,在CB中新建一個(gè)基于C++語(yǔ)言的項(xiàng)目,并打開(kāi)項(xiàng)目的
Build options...
進(jìn)行以下配置:
1. Other compiler options
2. Linker settings
3. Search directories
#includeint main(int argc, char** argv)
{auto app = Gtk::Application::create(argc, argv);
Gtk::Window window;
window.set_title("Hello,Gtkmm..");
window.set_default_size(400,300);
return app->run(window);
}
#include#include#include#includeclass Buttons : public Gtk::Window
{public:
Buttons();
virtual ~Buttons();
protected:
//Signal handlers:
void on_button_clicked();
//Child widgets:
Gtk::Button m_button;
};
Buttons::Buttons()
{m_button.add_pixlabel("info.xpm", "cool button");
set_title("Pixmap'd buttons!");
set_border_width(10);
set_default_size(280,40);
set_position(Gtk::WIN_POS_CENTER);
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 is clicked"<< std::endl;
}
int main(int argc, char *argv[])
{auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
Buttons buttons;
//Shows the window and returns when it is closed.
return app->run(buttons);
}
你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機(jī)房具備T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級(jí)服務(wù)器適合批量采購(gòu),新人活動(dòng)首月15元起,快前往官網(wǎng)查看詳情吧