KG6ZVP
KG6ZVP

Reputation: 3579

GTK Vala can't find gtk+-3 even though it is installed

I'm trying to create a simple GUI application with Vala to demonstrate running a basic application which shows a Gtk.Window. (I'm running Fedora 25 with up to date packages if it helps at all)

My window.vala file looks like this:

using GLib;
using Gtk;

class MWindow : Window {
    public MWindow(){
        //this.type = WindowType.TOPLEVEL;
        this.border_width = 12;
        this.destroy.connect(Gtk.main_quit);

        Button btn = new Button.with_label("Click");
        btn.clicked.connect(() => {
            btn.label = "clicked already";
        });

        this.add(btn);
        this.show_all();
    }

    public static int main(string[] args){
        MWindow mwin = new MWindow();
        Gtk.main();
        return 0;
    }
}

I'm compiling it like this:

valac --pkg gtk+-3.0 window.vala

I receive this error:

window.vala.c:7:21: fatal error: gtk/gtk.h: No such file or directory
 #include <gtk/gtk.h>
                     ^
compilation terminated.

I can't understand what is wrong because I have gtk+-devel and gtk3-devel installed as well as gtk+ and gtk3 installed. Is there something simple I'm missing? (I looked at this Stack Overflow question, but it isn't applicable to this problem).

Upvotes: 1

Views: 1464

Answers (1)

KG6ZVP
KG6ZVP

Reputation: 3579

The solution, as pointed out by Jens Mühlenhoff, was to run:

pkg-config --cflags gtk+3.0

and check it's output, which gave an error about X11 missing.

I had libX11-devel.i686, but not libX11-devel.x86_64, so I installed that package and the build worked.

Upvotes: 1

Related Questions