在 Vala 中使用包
Using packages in Vala
我正在学习关于 vala 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 的入门教程,我发现我必须使用名为 posix 的包。我试图在我的应用程序 class 的 activate
方法中添加以下行:
Posix.system("shutdown now");
然后编译使用:
valac --pkg gtk+-3.0 posix Application.vala
但是,我收到以下错误:
error: posix not found
Compilation failed: 1 error(s), 0 warning(s)
抱歉这个问题,但我是脚本语言的新手,我不知道如何在 Vala 中快速包含库。
试试这个:
valac --pkg gtk+-3.0 --pkg posix Application.vala
--pkg
参数后面需要一个单独的包名称,因此您必须使用与包一样多的 --pkg
参数。
我正在学习关于 vala 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 的入门教程,我发现我必须使用名为 posix 的包。我试图在我的应用程序 class 的 activate
方法中添加以下行:
Posix.system("shutdown now");
然后编译使用:
valac --pkg gtk+-3.0 posix Application.vala
但是,我收到以下错误:
error: posix not found
Compilation failed: 1 error(s), 0 warning(s)
抱歉这个问题,但我是脚本语言的新手,我不知道如何在 Vala 中快速包含库。
试试这个:
valac --pkg gtk+-3.0 --pkg posix Application.vala
--pkg
参数后面需要一个单独的包名称,因此您必须使用与包一样多的 --pkg
参数。