Page 1 of 1

Open file fails in MSVC debug mode.

Posted: 2014-03-28T11:39:08-07:00
by rthiebaud
Using MSVC Visual Express 2013 under Windows 8.1 with Magick++ 6.8.8-9 in debug mode, the following program fails with error:
Caught exception: img1.exe: unable to open image `Lùš': No such file or directory @ error/blob.c/OpenBlob/2645
ImageMagick-6.8.8-9-Q16-x86-dll.exe

The program works correctly when compiled in release mode.
#include "targetver.h"
#include <tchar.h>
#include "Magick++.h"
#include <iostream>
using namespace Magick;
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
try {
InitializeMagick("c:/temp/im");
Image im("c:/temp/clue.bmp");
}
catch (Exception &error_)
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}
The exception fails in line: Image im("c:/temp/clue.bmp");

c:\temp\clue.bmp is a valid bmp file.

The file name in the error message varies but always contains garbage characters.

Re: Open file fails in MSVC debug mode.

Posted: 2014-03-28T12:53:30-07:00
by dlemstra
Did you set the Character set to 'Use Multi-Byte Character Set' in both configurations?

Re: Open file fails in MSVC debug mode.

Posted: 2014-03-28T14:50:37-07:00
by rthiebaud
The program fails the same way in debug mode with character set of Multibyte, Unicode, or Not Set.

The program runs correctly in release mode with all three settings of character set.