How to include libadwaita-1 in compilation command?

I wrote this very simple program in Vala using Adw.Application class.

public class Application : Adw.Application {
	public Terminal() {
			application_id: "com.example.application",
			flags: ApplicationFlags.FLAGS_NONE
	protected override void activate() {
		var window = new Gtk.ApplicationWindow(this);
		window.title = "Application";

int main(string[] args) {
	var app = new Application();

I would like to compile this program. But, using old command line instead of Meson. But, I don’t know how to include libadwaita-1 or libadwaita package while compiling it.

I tried

$ valac --pkg libadwaita-1 --pkg gtk4 Application.vala -o Application && ./Application

And this throws following error.

error: Package `libadwaita-1' not found in specified Vala API directories or GObject-Introspection GIR directories
Compilation failed: 1 error(s), 0 warning(s)

How to correctly include this libadwaita-1 in compilation?

Are you maybe on Ubuntu/Debian or another distro that splits software into multiple packages? Specifically a distro that splits the development files of a library into its own package like libadwaita-1-dev. You’d need to install that.

This worked for me on Arch Linux:

valac test.vala --pkg libadwaita-1

Though I needed to rename public Terminal() to public Application() to make it compile.

Yes, that was the issue. Thank you @jakedane . I was confused previously. Because, I created a new project using GNOME Builder, there it works for Adw.Application. But, not if I created manually.

Just writing the steps here for ref. on how I resolve the issue.

I’m using Fedora and installed the libadwaita-devel package using following command.

sudo dnf install libadwaita-devel

Then using following command, I successfully able to run application.

valac --pkg libadwaita-1 Application.vala -o Application && ./Application

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.