Magick ++链接错误 [英] Magick++ linking error

查看:195
本文介绍了Magick ++链接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这里有一个使用Magick ++(ImageMagick接口)库的简单图像转换器代码。(Eclipse IDE)

I have here a simple image converter code using Magick++(ImageMagick interface) library.(Eclipse IDE)

#include <Magick++.h>
#include <string>
#include <iostream>

using namespace std;

using namespace Magick;

int main(int argc,char **argv) 
{ 
    Image image; 
    image.read("/home/usr1/test.tiff");
    image.write( "/home/usr1/test.bmp" ); 
    return 0;
}

我正在使用arm-linux目标进行交叉编译。代码编译成功,但在链接部分,我得到了未定义的引用错误。

I'am doing a cross compilation with arm-linux target. The code compiles successfully but on the linking part, I got undefined reference errors.

/usr/local/lib/libMagick++/libMagickCore.a(dlopen.o)(.text+0x144): In function `vm_open':
ltdl/loaders/dlopen.c:194: undefined reference to `dlopen'
/usr/local/lib/libMagick++/libMagickCore.a(dlopen.o)(.text+0x158):ltdl/loaders/dlopen.c:198: undefined reference to `dlerror'
/usr/local/lib/libMagick++/libMagickCore.a(dlopen.o)(.text+0x16c): In function `vm_close':
ltdl/loaders/dlopen.c:212: undefined reference to `dlclose'
/usr/local/lib/libMagick++/libMagickCore.a(dlopen.o)(.text+0x17c):ltdl/loaders/dlopen.c:214: undefined reference to `dlerror'
/usr/local/lib/libMagick++/libMagickCore.a(dlopen.o)(.text+0x198): In function `vm_sym':
ltdl/loaders/dlopen.c:227: undefined reference to `dlsym'
/usr/local/lib/libMagick++/libMagickCore.a(dlopen.o)(.text+0x1ac):ltdl/loaders/dlopen.c:231: undefined reference to `dlerror'

我使用以下命令编译代码:

I used the following command to compile the code:

/opt/Mx800SDK/vfitc/cross/bin/arm-linux-g++ -DMx870 -I/opt/Mx800SDK/vfitc/cross/arm-linux/include -I/usr/local/include/ImageMagick -I/opt/Mx800SDK/include -O2 -Wall -c -fmessage-length=0 -fno-strict-aliasing -o'main.o' '../main.cpp'

和链接:

/opt/Mx800SDK/vfitc/cross/bin/arm-linux-g++ -L/opt/Mx800SDK/lib -L/usr/local/lib/libMagick++ -o'imgConverter' ./main.o -lpthread -lMagick++ -lMagickWand -lMagickCore -ltiff -lz

还有其他吗?库我需要成功链接吗?我连接它吗?在此先感谢。

Is there any other library I need to link it successfully? Am I linking it right? Thanks in advance.

推荐答案

尝试反转Magick库,添加 MagickWand 库(并在最后放置libz和其他基本图像库,并在你使用时放置动态链接库):

Try inverting the Magick libraries, add the MagickWand library (and put libz and other base image libraries at the end, and the dynamic linker library while you're at it):

... -lpthread -lMagick++ -lMagickWand -lMagickCore -lz -ldl

参见链接器订单 - GCC ,了解静态库的顺序为何如此重要。

See Linker Order - GCC for why the order of static libraries matters.

这篇关于Magick ++链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆