Reputation: 3982
Source code in Vala:
using GLib;
using Gtk;
class MainWindow : Window {
public static int main (string[] args)
{
var window = new MainWindow();
window.destroy.connect(Gtk.main_quit);
window.show_all();
Gtk.main();
return 0;
}
public MainWindow()
{
this.title = "Title";
this.set_default_size(400, 450);
this.border_width = 10;
this.window_position = WindowPosition.CENTER;
this.destroy.connect(Gtk.main_quit);
var btnClear = new Button.with_label("Button");
add(btnClear);
}
}
When compiling on Ubuntu 13.10, I got error:
user@dev:/path$ valac --pkg gtk+-3.0 "dev.vala" -o dev
/path/dev.vala.c:7:21: fatal error: gtk/gtk.h: No such file or directory
#include <gtk/gtk.h>
^
compilation terminated.
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)
So, Ubuntu uses Gtk3. I've forcd to use gtk3.0 and make sure that libs for libgtk3 installed.
Secound question, If I want to develop Gtk 2.0 how can I do on Ubuntu if supports only Gtk 3?
Upvotes: 2
Views: 2359
Reputation: 14873
You have to install the libgtk-3-dev
package, too.
The -dev
suffixed packages in Debian and Ubuntu based distros contain files necessary for development.
In addition there is also a libgtk2-dev
package for Gtk+ 2.0 application development in Ubuntu.
Upvotes: 1