将Imagemagick C库与anjuta一起使用

时间:2014-01-17 15:21:12

标签: c imagemagick anjuta

我尝试在anjuta中的http://www.imagemagick.org/script/magick-wand.php中编译ImageMagic c代码。 我成功下载并编译了ImageMagic 然后从project-> Add Library ...

将库添加到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

请帮我解决这个问题

1 个答案:

答案 0 :(得分:0)

我想我找到了解决方案,安装libmagickwand-dev程序后正常使用,sudo apt-get install libmagickwand-dev命令我将MagicWand添加到项目中的库 - &gt;将库添加到anjuta -