gpt4 book ai didi

c++ - libsigc 如何包含在 gtkmm 项目中?

转载 作者:行者123 更新时间:2023-11-28 03:27:11 25 4
gpt4 key购买 nike

gtkmm tutorial hello world example libsigc++ 库在 helloword.cc 文件中使用:

#include "helloworld.h"
#include <iostream>

HelloWorld::HelloWorld()
: m_button("Hello World") // creates a new button with label "Hello World".
{
// Sets the border width of the window.
set_border_width(10);

// When the button receives the "clicked" signal, it will call the
// on_button_clicked() method defined below.
m_button.signal_clicked().connect(sigc::mem_fun(*this,
&HelloWorld::on_button_clicked));

// This packs the button into the Window (a container).
add(m_button);

// The final step is to display this newly created widget...
m_button.show();
}

但是,libsigc++ 从未包含在此文件中,但它仍然可以正常工作。 sigc 命名空间从何而来?

编辑:helloworld.h:

#ifndef GTKMM_EXAMPLE_HELLOWORLD_H
#define GTKMM_EXAMPLE_HELLOWORLD_H

#include <gtkmm/button.h>
#include <gtkmm/window.h>

class HelloWorld : public Gtk::Window
{

public:
HelloWorld();
virtual ~HelloWorld();

protected:
//Signal handlers:
void on_button_clicked();

//Member widgets:
Gtk::Button m_button;
};

#endif // GTKMM_EXAMPLE_HELLOWORLD_H

最佳答案

检查“gtkmm/window.h”的内容

http://fossies.org/unix/privat/gtkmm-3.6.0.tar.gz/dox/gtk_2gtkmm_2window_8h.html

它包括“sigc++.h”

关于c++ - libsigc 如何包含在 gtkmm 项目中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13614348/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com