为什么 Vala 编译器在使用问号 (?) 运算符时会抛出错误?

huangapple go评论47阅读模式
英文:

Why Vala Compiler Throws Errors When Using Question Mark (?) Operator?

问题

我尝试按照说明构建 G4Music(https://gitlab.gnome.org/neithern/g4music),但我遇到了许多语法错误。
如您所见,GTK-4.0 被标记为未找到。但是,我已安装了 GTK-4.4 开发包。
我正在使用 RHEL 9 作为发行版,并且已安装所有所需的包:

  • gtk4.x86_64
  • gtk4-devel.x86_64
  • libvala.x86_64
  • libvala-devel.x86_64
  • vala.x86_64
  • gstreamer1.x86_64
  • gstreamer1-devel.x86_64
  • libadwaita-1

我了解到 ? 运算符(问号)用于控制空值,而且有很多代码使用了这个运算符。
我对 Vala 语言没有经验。

我是否缺少某些库?为什么 Vala 编译器会因为这个运算符而报错?

提前感谢。

英文:

I tried to build G4Music (https://gitlab.gnome.org/neithern/g4music) following its instructions but I got many syntax errors.
为什么 Vala 编译器在使用问号 (?) 运算符时会抛出错误?

As you can see GTK-4.0 is marked as not found. However I have installed GTK-4.4 dev packages.
I'm using RHEL 9 as distro and I have all the packages required:

  • gtk4.x86_64
  • gtk4-devel.x86_64
  • libvala.x86_64
  • libvala-devel.x86_64
  • vala.x86_64
  • gstreamer1.x86_64
  • gstreamer1-devel.x86_64
  • libadwaita-1

I read that ? operator (question mark) is used to control null values and there's a lot of code using this operator.
I have no experience with Vala language.

Do I missing some libraries? Why Vala compiler throw errors for this operator?

Thanks in advance

答案1

得分: 0

看起来空条件运算符是在Vala 0.53.1中引入的,该版本于2021年8月20日发布。这是一个开发版本,所以您需要安装Vala 0.54+来进行编译。

要了解有关空条件运算符的更多信息,请阅读合并请求问题。理想情况下,g4music的构建系统应检查所需的Vala编译器的最低版本。

英文:

It looks like the null conditional operator was introduced in Vala 0.53.1, which was tagged 20 August 2021. That's a development release, so you want Vala 0.54+ installed to compile this.

To learn more about the null conditional operator read the merge request and issue. Ideally the build system for g4music would check for the minimum version of the Vala compiler needed.

huangapple
  • 本文由 发表于 2023年3月7日 11:55:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75657912.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定