【问题标题】:Mingw and libraw results in undefined referenceMingw 和 libraw 导致未定义的引用
【发布时间】:2012-10-06 16:21:26
【问题描述】:

有人在使用 libraw 和 mingw 吗?我正在尝试编译一个程序并得到以下错误:

obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRawC1Ej'|
obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRaw9open_fileEPKcx'|
obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRaw6unpackEv'|
obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRaw13dcraw_processEv'|
obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRaw20dcraw_make_mem_imageEPi'|
obj\Release\inc\img\cimg.o:cimg.cpp|| undefined reference to `_imp___ZN6LibRaw7recycleEv'|
obj\Release\inc\img\cimg.o:cimg.cpp:(.text$_ZN6LibRawD1Ev[LibRaw::~LibRaw()]+0xf)||undefined reference to `_imp___ZN6LibRaw7recycleEv'|
||=== Build finished: 7 errors, 0 warnings ===|

我将 libraw.a 添加到我的项目中。想不出问题。 有人有想法吗?

【问题讨论】:

    标签: c++ mingw


    【解决方案1】:

    从这些符号名称来看,您似乎正在尝试针对 libraw 的 DLL 版本进行编译(由 _imp___ 前缀暗示)。检查您的 libraw 头文件并确保函数名称前面没有 __declspec(dllimport)__attribute__((dllimport)) 之类的内容。这些有时会被宏定义隐藏,因此请检查头文件以查看您是否可以定义另一个宏,这将导致它不在函数原型中使用该属性。

    【讨论】:

    • 感谢您指出这一点。我查看了头文件,并且有这些 dllimport 的东西。无论如何,使用预处理器定义 LIBRAW_NODLL=1 我得到了它的工作,但现在我遇到了我在这里发布的另一个问题:stackoverflow.com/questions/12921911/…
    猜你喜欢
    • 2021-11-18
    • 2020-06-27
    • 1970-01-01
    • 1970-01-01
    • 2014-10-23
    • 1970-01-01
    • 1970-01-01
    • 2019-07-29
    • 2020-02-07
    相关资源
    最近更新 更多