Magick :: readImages-错误

时间:2013-07-06 19:58:01

标签: visual-c++ mfc imagemagick magick++

我最近成功安装了Magick ++并在我的MFC程序中使用它(经过大量的Visual C ++ 2010试用)。我的目标是将动画gif解码为许多位图。我需要所有的位图帧。我使用下面的代码,但收到了很多错误。如果有人可以帮助我,我很感激:)。如果有人通过示例向我推荐一个关于Magick ++的良好文档,我也很感激,因为我对这个库是全新的,这里是我的代码:

#include "stdafx.h"
#include <Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;

int main(int argc,char **argv)
{
InitializeMagick(*argv);

std::list<Magick::Image> imageList;

/* read all the frames of the animated GIF */
Magick::readImages( &imageList, "animated.gif" );

getchar();
return 0;
}

1>------ Rebuild All started: Project: test_Magiclibarary, Configuration: Debug Win32 ------
1>Build started 7/6/2013 12:52:35 AM.
1>InitializeBuildStatus:
1> Touching "Debug\test_Magiclibarary.unsuccessfulbuild".
1>ClCompile:
1> stdafx.cpp
1> test_MagiclibararyDlg.cpp
1>d:\shervin_zargham\industrial projects\led display\imagemagick-windows\imagemagick-6.8.5\magick++\lib\magick++\stl.h(2487): warning C4996: 'std::basic_string<_Elem,_Traits,_Ax>::copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xstring(1555) : see declaration of 'std::basic_string<_Elem,_Traits,_Ax>::copy'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> d:\shervin_zargham\industrial projects\led display\programming\mfc 2010\test_magiclibarary\test_magiclibarary\test_magiclibararydlg.cpp(212) : see reference to function template instantiation 'void Magick::readImages<std::list<_Ty>>(Container *,const std::string &)' being compiled
1> with
1> [
1> _Ty=Magick::Image,
1> Container=std::list<Magick::Image>
1> ]
1> test_Magiclibarary.cpp
1> Generating Code...
1>test_MagiclibararyDlg.obj : error LNK2019: unresolved external symbol __imp__DestroyExceptionInfo referenced in function "void __cdecl Magick::readImages<class std::list<class Magick::Image,class std::allocator<class Magick::Image> > >(class std::list<class Magick::Image,class std::allocator<class Magick::Image> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??$readImages@V?$list@VImage@Magick@@V?$allocator@VImage@Magick@@@std@@@std@@@Magick@@YAXPAV?$list@VImage@Magick@@V?$allocator@VImage@Magick@@@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z)
1>test_MagiclibararyDlg.obj : error LNK2019: unresolved external symbol __imp__DestroyImageInfo referenced in function "void __cdecl Magick::readImages<class std::list<class Magick::Image,class std::allocator<class Magick::Image> > >(class std::list<class Magick::Image,class std::allocator<class Magick::Image> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char>> const &)" (??$readImages@V?$list@VImage@Magick@@V?$allocator@VImage@Magick@@@std@@@std@@@Magick@@YAXPAV?$list@VImage@Magick@@V?$allocator@VImage@Magick@@@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z)
1>test_MagiclibararyDlg.obj : error LNK2019: unresolved external symbol __imp__ReadImage referenced in function "void __cdecl Magick::readImages<class std::list<class Magick::Image,class std::allocator<class Magick::Image> > >(class std::list<class Magick::Image,class std::allocator<class Magick::Image> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??$readImages@V?$list@VImage@Magick@@V?$allocator@VImage@Magick@@@std@@@std@@@Magick@@YAXPAV?$list@VImage@Magick@@V?$allocator@VImage@Magick@@@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z)
1>test_MagiclibararyDlg.obj : error LNK2019: unresolved external symbol __imp__GetExceptionInfo referenced in function "void __cdecl Magick::readImages<class std::list<class Magick::Image,class std::allocator<class Magick::Image> > >(class std::list<class Magick::Image,class std::allocator<class Magick::Image> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char>> const &)" (??$readImages@V?$list@VImage@Magick@@V?$allocator@VImage@Magick@@@std@@@std@@@Magick@@YAXPAV?$list@VImage@Magick@@V?$allocator@VImage@Magick@@@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z)
1>test_MagiclibararyDlg.obj : error LNK2019: unresolved external symbol __imp__CloneImageInfo referenced in function "void __cdecl Magick::readImages<class std::list<class Magick::Image,class std::allocator<class Magick::Image> > >(class std::list<class Magick::Image,class std::allocator<class Magick::Image> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >const &)" (??$readImages@V?$list@VImage@Magick@@V?$allocator@VImage@Magick@@@std@@@std@@@Magick@@YAXPAV?$list@VImage@Magick@@V?$allocator@VImage@Magick@@@std@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z)
1>D:\Shervin_Zargham\Industrial Projects\LED Display\Programming\MFC 2010\test_Magiclibarary\Debug\test_Magiclibarary.exe : fatal error LNK1120: 5 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:10.26
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

1 个答案:

答案 0 :(得分:0)

我认为您的问题与命名空间(examplesdefinition)更相关。以下代码应实现从动画GIFS中提取位图的目标。

#include <Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;

int main(int argc,char **argv)
{
    InitializeMagick(*argv);

    list<Image> imageList;

    /* read all the frames of the animated GIF */
    readImages( &imageList, "animated.gif" );

    /* Iterate trough images and write to bitmap */
    writeImages(imageList.begin(),imageList.end(),"animated%02d.bmp",true);

    return 0;
}

其他Magick ++示例可在课程文档中找到。