Different results for same code

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
kirash4
Posts: 34
Joined: 2010-04-12T15:30:59-07:00
Authentication code: 8675308

Different results for same code

Post by kirash4 »

I'm scratching my head and wondering if anyone here might have an idea as to what's going on. I have the following snippet:

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;
}
When I compile that on a unix server then try to feed it an invalid image format, it will return an exception telling me there's no decode delegate for that, as I would expect it would. However, when I compile this same exact snippet on my Cygwin environment, I get nothing back, or rather, what appears to be a blank line:

On unix:
> ./test test.cpp
Caught exception: test: no decode delegate for this image format `test.cpp' @ error/constitute.c/ReadImage/501
>
On Cygwin:
> ./test test.cpp

>
Or if I use the full file name on Cygwin:
> ./text.exe text.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.
Post Reply