--------------------------------------------------------------------------------------
Trable:
|
Code: Select all
|=== Build: Debug in imaga (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `main':|
C:\Users\viewrock\Desktop\Codeblocks\imaga\main.cpp|9|undefined reference to `Magick::InitializeMagick(char const*)'|
C:\Users\viewrock\Desktop\Codeblocks\imaga\main.cpp|14|undefined reference to `Magick::Image::Image()'|
C:\Users\viewrock\Desktop\Codeblocks\imaga\main.cpp|17|undefined reference to `Magick::Image::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'|
C:\Users\viewrock\Desktop\Codeblocks\imaga\main.cpp|20|undefined reference to `Magick::Geometry::Geometry(unsigned int, unsigned int, int, int)'|
C:\Users\viewrock\Desktop\Codeblocks\imaga\main.cpp|20|undefined reference to `Magick::Image::crop(Magick::Geometry const&)'|
C:\Users\viewrock\Desktop\Codeblocks\imaga\main.cpp|20|undefined reference to `Magick::Geometry::~Geometry()'|
C:\Users\viewrock\Desktop\Codeblocks\imaga\main.cpp|23|undefined reference to `Magick::Image::write(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'|
C:\Users\viewrock\Desktop\Codeblocks\imaga\main.cpp|14|undefined reference to `Magick::Image::~Image()'|
C:\Users\viewrock\Desktop\Codeblocks\imaga\main.cpp|20|undefined reference to `Magick::Geometry::~Geometry()'|
C:\Users\viewrock\Desktop\Codeblocks\imaga\main.cpp|14|undefined reference to `Magick::Image::~Image()'|
||error: ld returned 1 exit status|
||=== Build failed: 11 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|
Code:
Code: Select all
#include <Magick++.h>
#include <iostream>
using namespace std;
int main(int argc,char **argv)
{
Magick::InitializeMagick(*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.
Magick::Image image;
try {
// Read a file into image object
image.read( "logo:" );
// Crop the image to specified size (width, height, xOffset, yOffset)
image.crop( Magick::Geometry(100,100, 100, 100) );
// Write the image to a file
image.write( "logo.png" );
}
catch( Magick::Exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}