1

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.

Community
  • 1
  • 1
SaidbakR
  • 13,303
  • 20
  • 101
  • 195

1 Answers1

3

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.

umonkey
  • 106
  • 1
  • 3
  • Thank you. I'd like to mention that in `meson.build` **poisx** is not stated in dependencies using `dependency()` method but using get_compiler like: `meson.get_compiler('vala').find_library('posix')` – SaidbakR Dec 18 '19 at 19:05