【问题标题】:"undefined reference to `gtk_label_set_xalign'" when compiling a Vala application编译 Vala 应用程序时“未定义对 `gtk_label_set_xalign' 的引用”
【发布时间】:2015-09-10 10:23:18
【问题描述】:

我正在编写一个 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);

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

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

我尝试将最后一个字符串替换为titleLabel.xalign = 0,但结果还是一样。

我该如何解决?

【问题讨论】:

    标签: user-interface cmake alignment label vala


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-02
      • 2012-08-16
      • 2023-03-10
      • 2016-08-28
      相关资源
      最近更新 更多