gpt4 book ai didi

c - 将 Imagemagic C 库与 anjuta 一起使用

转载 作者:行者123 更新时间:2023-11-30 17:41:16 28 4
gpt4 key购买 nike

我尝试编译 http://www.imagemagick.org/script/magick-wand.php 中的 ImageMagic c 代码在安尤塔。我成功下载并编译了ImageMagic然后从项目->添加库...将库添加到 anjuta

然后我尝试运行下面从上面链接获取的代码

#include <stdio.h>
#include <stdlib.h>
#include <wand/MagickWand.h>

int main(int argc,char **argv)
{
#define ThrowWandException(wand) \
{ \
char \
*description; \
\
ExceptionType \
severity; \
\
description=MagickGetException(wand,&severity); \
(void) fprintf(stderr,"%s %s %lu %s\n",GetMagickModule(),description); \
description=(char *) MagickRelinquishMemory(description); \
exit(-1); \
}

MagickBooleanType
status;

MagickWand
*magick_wand;

if (argc != 3)
{
(void) fprintf(stdout,"Usage: %s image thumbnail\n",argv[0]);
exit(0);
}
/*
Read an image.
*/
MagickWandGenesis();
magick_wand=NewMagickWand();
status=MagickReadImage(magick_wand,argv[1]);
if (status == MagickFalse)
ThrowWandException(magick_wand);
/*
Turn the images into a thumbnail sequence.
*/
MagickResetIterator(magick_wand);
while (MagickNextImage(magick_wand) != MagickFalse)
MagickResizeImage(magick_wand,106,80,LanczosFilter,1.0);
/*
Write the image then destroy it.
*/
status=MagickWriteImages(magick_wand,argv[2],MagickTrue);
if (status == MagickFalse)
ThrowWandException(magick_wand);
magick_wand=DestroyMagickWand(magick_wand);
MagickWandTerminus();
return(0);
}

但是我遇到了这个错误。

main.o: In function ‘main’:
main.c'.35: undefined reference to ‘MagickWandGenesis'
main.c'.36: undefined reference to ‘NewMagicWand'
main.c:37: undefined reference to ‘ MagickReadImage'
main.c39: undefined reference to ‘ MagickGefException'
main.c:39: undefined reference to ‘MagickRelinquishMernory'
main.c:43: undefined reference to ‘ MagickResetlterator'
main.c:45: undefined reference to ‘ Magickkesimelmage
main.c:l4: undefined reference to ‘ MagickNextImage'
main.c:49: undefined reference to ‘Magickwritelmages'
main.c:51: undefined reference to ‘ MagickGetException'
main.c:51: undefined reference to ‘Magickkelinquishuemory
main.c:52: undefined reference to ‘ DestroyMagickWand'
main.c:53: undefined reference to ‘MagickWandTerminus'
collect2: Id returned 1 exit status

请帮我解决这个问题

最佳答案

我想我找到了解决方案,在我安装 libmagickwand-dev 程序后,使用 sudo apt-get install libmagickwand-dev 命令可以正常工作。在我将 MagicWand 添加到项目中的库后 -> 将库添加到 anjuta –

关于c - 将 Imagemagic C 库与 anjuta 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21189408/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com