#include <gtk/gtk.h>
#include <string>
using namespace std;
class WIN
{
protected:
GtkWidget *window;
public:
GtkWidget* get_window(){ return window; }
void set_window(GtkWidget* w){ window = w; }
void set_title(string s)
{
gtk_window_set_title (GTK_WINDOW(window), s.c_str());
}
};
int main (int argc, char *argv[])
{
/* Initialize GTK+ and all of its supporting libraries. */
gtk_init (&argc, &argv);
WIN obj1;
obj1.set_window(gtk_window_new (GTK_WINDOW_TOPLEVEL));
obj1.set_title("Hello World");
GtkWidget *w = obj1.get_window();
obj1.set_window(gtk_widget_show(w));
/* Hand control over to the main loop. */
gtk_main();
return 0;
}
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
- What is the correct way to declare and use a FILE
gtk_widget_show()
returns void.You're calling
obj1.set_window(void)
Change:
To
Seems like gtk_widget_show() returns void. That's the void expression you are using in an invalid way.
http://library.gnome.org/devel/gtk/2.99/GtkWidget.html