Open file fails in MSVC debug mode.

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
rthiebaud
Posts: 2
Joined: 2014-03-28T11:20:51-07:00
Authentication code: 6789

Open file fails in MSVC debug mode.

Post 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.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Open file fails in MSVC debug mode.

Post by dlemstra »

Did you set the Character set to 'Use Multi-Byte Character Set' in both configurations?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
rthiebaud
Posts: 2
Joined: 2014-03-28T11:20:51-07:00
Authentication code: 6789

Re: Open file fails in MSVC debug mode.

Post 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.
Post Reply