I'm only just trying to get the hang of Magic++ and trying out the following bit of code (in Visual Studio .NET 2003). The code compiles OK but crashes without any error when I run it. BTW, I'm using the development headers and lib files that come with the precompiled Windows binary.
Edit: when I ran the program though a debugger I found that Image::write() causes "unhandled exception".
magick wrote:Do you choose the Release build rather than the default Debug build?
Thanks. I was developing in Debug mode and now I've switched to Release mode. Unfortunately, compiling in Release mode, Single-threaded (/ML), produces a slew of linker errors:
ImageMagicTest.obj : error LNK2019: unresolved external symbol "public: __thiscall Magick::Geometry::~Geometry(void)" (??1Geometry@Magick@@QAE@XZ) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Magick::ColorRGB::~ColorRGB(void)" (??1ColorRGB@Magick@@UAE@XZ) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Magick::Image::~Image(void)" (??1Image@Magick@@UAE@XZ) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "public: void __thiscall Magick::Image::write(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?write@Image@Magick@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "public: __thiscall Magick::Image::Image(class Magick::Geometry const &,class Magick::Color const &)" (??0Image@Magick@@QAE@ABVGeometry@1@ABVColor@1@@Z) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "public: __thiscall Magick::ColorRGB::ColorRGB(double,double,double)" (??0ColorRGB@Magick@@QAE@NNN@Z) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "public: __thiscall Magick::Geometry::Geometry(unsigned int,unsigned int,long,long,bool,bool)" (??0Geometry@Magick@@QAE@IIJJ_N0@Z) referenced in function _main
Release/TestBed.exe : fatal error LNK1120: 7 unresolved externals
Thinking the problem was because the prebuilt version binary was not distributed did not contain all the required libraries I tried compiling the whole all of Magick under Visual Studio .NET (2003), and it pretty much went well with the exception of the following two linker errors
Compiling...
ImageMagicTest.cpp
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(456) : warning C4251: 'Magick::DrawableBezier::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::DrawableBezier'
with
[
_Ty=Magick::Coordinate
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(1128) : warning C4251: 'Magick::DrawablePath::_path' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::DrawablePath'
with
[
_Ty=Magick::VPath
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(1217) : warning C4251: 'Magick::DrawablePolygon::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::DrawablePolygon'
with
[
_Ty=Magick::Coordinate
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(1237) : warning C4251: 'Magick::DrawablePolyline::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::DrawablePolyline'
with
[
_Ty=Magick::Coordinate
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2255) : warning C4251: 'Magick::PathArcAbs::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathArcAbs'
with
[
_Ty=Magick::PathArcArgs
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2277) : warning C4251: 'Magick::PathArcRel::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathArcRel'
with
[
_Ty=Magick::PathArcArgs
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2428) : warning C4251: 'Magick::PathCurvetoAbs::_args' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathCurvetoAbs'
with
[
_Ty=Magick::PathCurvetoArgs
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2451) : warning C4251: 'Magick::PathCurvetoRel::_args' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathCurvetoRel'
with
[
_Ty=Magick::PathCurvetoArgs
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2475) : warning C4251: 'Magick::PathSmoothCurvetoAbs::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathSmoothCurvetoAbs'
with
[
_Ty=Magick::Coordinate
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2500) : warning C4251: 'Magick::PathSmoothCurvetoRel::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathSmoothCurvetoRel'
with
[
_Ty=Magick::Coordinate
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2609) : warning C4251: 'Magick::PathQuadraticCurvetoAbs::_args' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathQuadraticCurvetoAbs'
with
[
_Ty=Magick::PathQuadraticCurvetoArgs
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2633) : warning C4251: 'Magick::PathQuadraticCurvetoRel::_args' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathQuadraticCurvetoRel'
with
[
_Ty=Magick::PathQuadraticCurvetoArgs
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2657) : warning C4251: 'Magick::PathSmoothQuadraticCurvetoAbs::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathSmoothQuadraticCurvetoAbs'
with
[
_Ty=Magick::Coordinate
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2681) : warning C4251: 'Magick::PathSmoothQuadraticCurvetoRel::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathSmoothQuadraticCurvetoRel'
with
[
_Ty=Magick::Coordinate
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2709) : warning C4251: 'Magick::PathLinetoAbs::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathLinetoAbs'
with
[
_Ty=Magick::Coordinate
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2733) : warning C4251: 'Magick::PathLinetoRel::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathLinetoRel'
with
[
_Ty=Magick::Coordinate
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2875) : warning C4251: 'Magick::PathMovetoAbs::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathMovetoAbs'
with
[
_Ty=Magick::Coordinate
]
C:\Program Files\ImageMagick-6.6.9-Q16\include\Magick++\Drawable.h(2899) : warning C4251: 'Magick::PathMovetoRel::_coordinates' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'Magick::PathMovetoRel'
with
[
_Ty=Magick::Coordinate
]
Linking...
ImageMagicTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Magick::Geometry::~Geometry(void)" (__imp_??1Geometry@Magick@@QAE@XZ) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::ColorRGB::~ColorRGB(void)" (__imp_??1ColorRGB@Magick@@UAE@XZ) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Image::~Image(void)" (__imp_??1Image@Magick@@UAE@XZ) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Magick::Image::write(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?write@Image@Magick@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Magick::Image::Image(class Magick::Geometry const &,class Magick::Color const &)" (__imp_??0Image@Magick@@QAE@ABVGeometry@1@ABVColor@1@@Z) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Magick::ColorRGB::ColorRGB(double,double,double)" (__imp_??0ColorRGB@Magick@@QAE@NNN@Z) referenced in function _main
ImageMagicTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Magick::Geometry::Geometry(unsigned int,unsigned int,long,long,bool,bool)" (__imp_??0Geometry@Magick@@QAE@IIJJ_N0@Z) referenced in function _main
Release/TestBed.exe : fatal error LNK1120: 7 unresolved externals
BTW, I've tried compiling the entire library in both Debug and Release mode and both times I got the error "unresolved external symbol __fseek" and "unresolved external symbol __ftell"