【问题标题】:Compiling vala with cmake: `Undefined reference to 'g_thread_init'`使用 cmake 编译 vala:`未定义的对 'g_thread_init' 的引用`
【发布时间】:2013-08-24 20:29:41
【问题描述】:

我对 vala 很陌生,我正在尝试使用 CMAKE 构建一些东西。然而,接近尾声时它会抛出undefined reference to 'g_thread_init'。我已将 --thread 添加到 ValaPrecompile 的 OPTIONS 部分。我也尝试添加pkg_check_modules(DEPS REQUIRED gthread-2.0)add_definitions(${CFLAGS} -lgthread-2.0 ),但没有运气。

pkg-config --libs gthread-2.0 的输出:

-pthread -lgthread-2.0 -lrt -lglib-2.0 

有什么想法吗?

【问题讨论】:

  • 只是猜测,你有没有试过在-lgthread-2.0之后移动-pthread

标签: cmake vala


【解决方案1】:

可能还有其他解决方案,但我最终针对同样的问题所做的如下:

target_link_libraries(myTarget ${LIBRARIES} gthread-2.0)

其中 myTarget 是您的目标二进制文件,LIBRARIES 是您的其他库列表。

【讨论】:

    猜你喜欢
    • 2019-09-05
    • 1970-01-01
    • 1970-01-01
    • 2016-07-25
    • 1970-01-01
    • 2021-04-20
    • 2017-05-14
    • 1970-01-01
    • 2021-05-21
    相关资源
    最近更新 更多