?
Solved

How do you use ImageMagick?

Posted on 2005-03-06
1
Medium Priority
?
536 Views
Last Modified: 2008-01-09
I have Windows XP and Visual C++ 6.0.  I downloaded ImageMagick, built the config program, ran it, and then built "VisualDynamicMT".  From the ImageMagick website, this sample program is given for resizing an image:

#include <Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
  // Construct the image object. Seperating image construction from the
  // the read operation ensures that a failure to read the image file
  // doesn't render the image object useless.
  Image image;
  try {
    // Read a file into image object
    image.read( "girl.gif" );

    // Crop the image to specified size (width, height, xOffset, yOffset)
    image.crop( Geometry(100,100, 100, 100) );

    // Write the image to a file
    image.write( "x.gif" );
  }
  catch( Exception &error_ )
    {
      cout << "Caught exception: " << error_.what() << endl;
      return 1;
    }
  return 0;
}

I compiled this with no errors (1 warning) but when I build it I get this:

--------------------Configuration: mytest - Win32 Debug--------------------
Linking...
mytest.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall Magick::Image::~Image(void)" (??1Image@Magick@@UAE@XZ)
mytest.obj : error LNK2001: 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?$ch
ar_traits@D@std@@V?$allocator@D@2@@std@@@Z)
mytest.obj : error LNK2001: unresolved external symbol "public: __thiscall Magick::Geometry::~Geometry(void)" (??1Geometry@Magick@@QAE@XZ)
mytest.obj : error LNK2001: unresolved external symbol "public: void __thiscall Magick::Image::crop(class Magick::Geometry const &)" (?crop@Image@Magick@@QAEXABVGeometry@2@@Z)
mytest.obj : error LNK2001: unresolved external symbol "public: __thiscall Magick::Geometry::Geometry(unsigned int,unsigned int,unsigned int,unsigned int,bool,bool)" (??0Geometry@Magick@@QAE@IIII_N0@Z)
mytest.obj : error LNK2001: unresolved external symbol "public: void __thiscall Magick::Image::read(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?read@Image@Magick@@QAEXABV?$basic_string@DU?$char
_traits@D@std@@V?$allocator@D@2@@std@@@Z)
mytest.obj : error LNK2001: unresolved external symbol "public: __thiscall Magick::Image::Image(void)" (??0Image@Magick@@QAE@XZ)
Debug/mytest.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.

mytest.exe - 8 error(s), 0 warning(s)

I have no idea what any of this means.  What do I need to do in order to use ImageMagick?
0
Comment
Question by:neoanderz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 1000 total points
ID: 13478261
You first need to build the library containing these functions from the files in 'Magick++/lib' - then, add the .lib to your project. Of yourse, you could also just add

Blob.cpp
BlobRef.cpp
CoderInfo.cpp
Color.cpp
Drawable.cpp
Exception.cpp
Functions.cpp
Geometry.cpp
Image.cpp
ImageRef.cpp
Montage.cpp
Options.cpp
Pixels.cpp
STL.cpp
Thread.cpp
TypeMetric.cpp

to your project, but IMHO using a .lib is 'cleaner'
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question