0

我的具体错误是尝试从此处运行 GDBus 示例代码时:https ://developer.gnome.org/gio/2.30/GDBusConnection.html

错误如下所示:

/usr/bin/ld: main.o: undefined reference to symbol 'g_variant_type_checked_'

//usr/lib64/libglib-2.0.so.0: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status

make: *** [GDbus_test] Error 1
4

1 回答 1

1

您需要通过将库添加到 .pro 文件中LIBS += ....

在尝试了“libglib-2.0”的不成功变体后,我了解到从错误中获取库名称的方法是将“lib”替换为“-l”,因此-lglib-2.0。

添加后错误解决

LIBS += -lglib-2.0

\  -lgio-2.0 \
    -lgobject-2.0 \ 

当那些丢失的 DSO 错误然后弹出时(libgio-2.0 和 libgobject-2.0)

于 2018-08-22T15:23:29.827 回答