【问题标题】:Qt Creator failed on running program when linking /usr/local/lib链接 /usr/local/lib 时,Qt Creator 运行程序失败
【发布时间】:2016-05-25 06:33:43
【问题描述】:

给定以下简单的项目:

QT += core
QT -= gui

TARGET = ConsoleTest08
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

LIBS += -L/usr/local/lib

使用这个简单的 main.cpp 文件:

int main(int argc, char *argv[])
{
    return 0;
}

Qt Creator 运行时,出现以下错误:

dyld: Symbol not found: __cg_png_create_info_struct
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libPng.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
The program has unexpectedly finished.

从终端运行良好。

这是我的配置:

  • OSX 10.9
  • Qt 5.5.1 clang 64 biy
  • Qt Creator 3.6.0

我最近更新到 Qt Creator 3.6.0,所以我怀疑存在错误。

我通过 brew 安装了 libpng 1.6.21,它与 ImageIO 框架有冲突,但我没有明确链接他们。

知道发生了什么吗?

【问题讨论】:

    标签: macos qt libpng


    【解决方案1】:

    我通过在我的项目运行部分取消选中这个新的将构建库搜索路径添加到DYLD_LIBRARY_PATH和DYLD_FRAMEWORK_PATH复选框解决了我的问题:

    【讨论】:

    • 我很高兴这解决了你的问题,你知道它做了什么以及它是如何解决的吗?或者您的问题实际上是什么?
    • 系统库和自制软件安装的可能有冲突。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-08-13
    • 1970-01-01
    • 2013-04-18
    • 2021-02-09
    • 1970-01-01
    • 1970-01-01
    • 2012-07-05
    相关资源
    最近更新 更多