Code: Select all
#include <Magick++.h>
#include <iostream>
int main(int argc, char *argv[]) {
Magick::InitializeMagick(*argv);
static char const *filename = argv[1];
try {
Magick::Image originalImage(filename);
}
catch (Magick::Exception & error) {
std::cerr << "Caught exception: " << error.what() << std::endl;
}
return 0;
}
On unix:
On Cygwin:> ./test test.cpp
Caught exception: test: no decode delegate for this image format `test.cpp' @ error/constitute.c/ReadImage/501
>
Or if I use the full file name on Cygwin:> ./test test.cpp
>
Note that there is an empty line on the Cygwin output, which makes me think it is outputting something, or at least trying to. So why am I not getting the exception notice on Cygwin? It doesn't matter if I use std::cerr or std::cout for that matter.> ./text.exe text.cpp
>