编译Vala应用程序时"未定义对`gtk_label_set_xalign'的引用"

ser*_*off 2 user-interface label cmake alignment vala

我正在写一个Vala应用程序,我在其中使用标签.这是构造函数(我想这是导致错误的地方):

titleLabel = new Gtk.Label("");
titleLabel.set_markup(wrapInTags(post.title));
titleLabel.set_line_wrap(true);
titleLabel.wrap_mode = Pango.WrapMode.WORD_CHAR;
titleLabel.set_justify(Gtk.Justification.LEFT);
//titleLabel.set_max_width_chars(40);
titleLabel.set_xalign(0);
Run Code Online (Sandbox Code Playgroud)

当我编译它时,会发生这种情况:

CMakeFiles/photostream.dir/Widgets/PostBox.c.o: In function `photo_stream_widgets_post_box_construct':
PostBox.c:(.text+0x2111): undefined reference to `gtk_label_set_xalign'
CMakeFiles/photostream.dir/Widgets/CommentsBox.c.o: In function `photo_stream_widgets_comment_box_construct':
CommentsBox.c:(.text+0x1045): undefined reference to `gtk_label_set_xalign'
CMakeFiles/photostream.dir/Widgets/NewsBox.c.o: In function `photo_stream_widgets_news_box_construct':
NewsBox.c:(.text+0x1af8): undefined reference to `gtk_label_set_xalign'
CMakeFiles/photostream.dir/Windows/BulkDownloadWindow.c.o: In function `photo_stream_bulk_download_window_construct':
BulkDownloadWindow.c:(.text+0x14b1): undefined reference to `gtk_label_set_xalign'
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

我试图替换最后一个字符串titleLabel.xalign = 0,但结果仍然相同.

我该如何解决?

ser*_*off 6

似乎我找到了答案,根据这个:https://developer.gnome.org/gtk3/stable/GtkLabel.htmlgtk_label_set_xalign()方法可用,因为GTK + 3.16,我使用的是3.14.