SaidbakR
SaidbakR

Reputation: 13544

Using packages in Vala

I'm following an introductory tutorial about and I want to make a simple application that simply shutdown the computer using the command shutdown now. I checked out this question Executing system command in Vala, and I found that I have to use a package named posix. I tried to add the following line in the activate method of my Application class:

Posix.system("shutdown now");

Then compile using:

valac --pkg gtk+-3.0 posix Application.vala

However, I got the following Error:

error: posix not found

Compilation failed: 1 error(s), 0 warning(s)

Sorry for this question but I'm new comer from scripting languages and I don't no how to quickly include libraries in Vala.

Upvotes: 2

Views: 338

Answers (1)

umonkey
umonkey

Reputation: 116

Try this:

valac --pkg gtk+-3.0 --pkg posix Application.vala

The --pkg argument needs a single package name after it, so you have to use as many --pkg arguments as you have packages.

Upvotes: 4

Related Questions