Question

I am trying to use Magick++ with Code::Blocks (both are latest versions). I use win7 x64 and I installed both ImageMagick x86 and x64 dynamic (with DLLs).

Every time I try to run a demo c++ file (like the code below,) I get the same message:

\ImageMagick-6.8.6-Q16\include\"  -c C:\Users\ad\Desktop\C++\Magick++\test\main.cpp -o obj\Debug\main.o
mingw32-g++.exe: fatal error: no input files
compilation terminated.
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)

does anybody has experienced this? Could you help me to make it work?

I put a .jpg file "wall.jpg" in the same folder as the project.

Thanks

Source code from the magick++ demo folder

#include <Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
  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.
  Image image;
  try {
    // Read a file into image object
    image.read( "wall.jpg" );

    // 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;
}
Was it helpful?

Solution

may be your input path is error set or your account don't have privilege to read the file in "C:\Users\ad\Desktop\C++\Magick++\test\main.cpp",check it and try again

OTHER TIPS


Hello ,

the problem is not the missing "wall.jpg", but the compilation process (creating the executable binary) , as your example output shows :

mingw32-g++.exe: fatal error: no input files

To find out what is going wrong, you should post the command you run and the complete error output.


Best,

Jack

I think the error happened in the first sentence of main:InitializeMagick(*argv), you can debug into this calling, may be it's caused by the NULL pointer of argv.

Oh, no, the project didn't even compile! (see the error msg)

I think you should revise the way you used to create your project. Personally, i double checked how to create a project and luckily worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top