Debug crash when using Visual Studio
Debug crash when using Visual Studio
Hey All,
I have written a small program to test out ImageMagick.
It is a dialog based MFC app.
If I run the program in release mode, it works perfectly, loading an image and writing it back out in a different format.
However in debug mode, it crashes on the read(), the exception doesn't even get trapped!
Has anyone had similar issues and found a sloution please?
Thanks heaps,
Steve Q.
I have written a small program to test out ImageMagick.
It is a dialog based MFC app.
If I run the program in release mode, it works perfectly, loading an image and writing it back out in a different format.
However in debug mode, it crashes on the read(), the exception doesn't even get trapped!
Has anyone had similar issues and found a sloution please?
Thanks heaps,
Steve Q.
Re: Debug crash when using Visual Studio
You may need to build ImageMagick from source in debug mode to use within a debug application. We're not completely sure because we are primarily Linux developers.
Re: Debug crash when using Visual Studio
Thanks magick,
No worries, where do I get the source and is there a visual studio workspace included with it?
Thanks heaps,
Steve Q.
No worries, where do I get the source and is there a visual studio workspace included with it?
Thanks heaps,
Steve Q.
Re: Debug crash when using Visual Studio
See http://www.imagemagick.org/script/insta ... hp#windows for the ImageMagick Windows source and build instructions.
Re: Debug crash when using Visual Studio
Thanks again magick,
Your support is amazing!
I really appreciate your help.
Steve Q.
Your support is amazing!
I really appreciate your help.
Steve Q.
Re: Debug crash when using Visual Studio
Thanks magic,
Rebuilding in Visual Studio fixed the crash!
CYA
Steve
Rebuilding in Visual Studio fixed the crash!
CYA
Steve
Re: Debug crash when using Visual Studio
Hi
Did you find a solution. I'm having the exact same problems - however, a recompile of the imagemagick framework doesn't work here.
- Preben
Did you find a solution. I'm having the exact same problems - however, a recompile of the imagemagick framework doesn't work here.
- Preben
Re: Debug crash when using Visual Studio
Hey Preben,
I downloaded the Windows source, then I built them in VS.
Make sure you are using the Debug DLLs and .lib and not the release versions when running in debug mode. I just copied the debug DLLs into the debug directory where the final .exe was built.
All is fine now and I can run the debug code happily!
CAY
Steve
I downloaded the Windows source, then I built them in VS.
Make sure you are using the Debug DLLs and .lib and not the release versions when running in debug mode. I just copied the debug DLLs into the debug directory where the final .exe was built.
All is fine now and I can run the debug code happily!
CAY
Steve
Re: Debug crash when using Visual Studio
Hmm... Yeah I'm having some trouble with that...
I used the configure.exe file to construct a project under the VisualMagick folder. I selected the 8bit per colour instead of the 16bit and uses a static single threaded library.
I'm gonna try the new version now - I have been using 6.5.2-Q8 version. However, I don't think it'll change anything.
- Preben
I used the configure.exe file to construct a project under the VisualMagick folder. I selected the 8bit per colour instead of the 16bit and uses a static single threaded library.
I'm gonna try the new version now - I have been using 6.5.2-Q8 version. However, I don't think it'll change anything.
- Preben
Re: Debug crash when using Visual Studio
Are you using any special settings for your project - or just the default ones that Visual Studio provides for you!
- Preben
- Preben
Re: Debug crash when using Visual Studio
Yeah.... I used the 16bpp version, sorry I can't be of more help.
Re: Debug crash when using Visual Studio
No I jut used the configuration that was built for me... I didn't change anything.
Re: Debug crash when using Visual Studio
Maybe you can help anyway... When compiling my own project everything seems fine, however debugging gets errors
How are the settings for your project?
I unzipped the ImageMagick library to the root of my computer:
C:\ImageMagick-6.6.0
- added C:\ImageMagick-6.6.0\VisualMagick\bin to the system PATH
Set up my project to use:
Linker library directories:
- C:\ImageMagick-6.6.0\VisualMagick\bin
- C:\ImageMagick-6.6.0\VisualMagick\lib
and Linker libraries:
- CORE_DB_magick_.lib
- CORE_DB_Magick++_.lib
and Include directories
- C:\ImageMagick-6.6.0\
- C:\ImageMagick-6.6.0\Magick++\lib
and I set up the preprocessor definitions for the project:
- NOMINMAX;NDEBUG;WIN32;_CONSOLE;_VISUALC_;NeedFunctionPrototypes;_DLL;_MAGICKMOD_;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS
When debugging I get this stack trace:
What is wrong?
- Preben
How are the settings for your project?
I unzipped the ImageMagick library to the root of my computer:
C:\ImageMagick-6.6.0
- added C:\ImageMagick-6.6.0\VisualMagick\bin to the system PATH
Set up my project to use:
Linker library directories:
- C:\ImageMagick-6.6.0\VisualMagick\bin
- C:\ImageMagick-6.6.0\VisualMagick\lib
and Linker libraries:
- CORE_DB_magick_.lib
- CORE_DB_Magick++_.lib
and Include directories
- C:\ImageMagick-6.6.0\
- C:\ImageMagick-6.6.0\Magick++\lib
and I set up the preprocessor definitions for the project:
- NOMINMAX;NDEBUG;WIN32;_CONSOLE;_VISUALC_;NeedFunctionPrototypes;_DLL;_MAGICKMOD_;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS
When debugging I get this stack trace:
Code: Select all
msvcr80d.dll!memcpy(unsigned char * dst=0x0990e0d0, unsigned char * src=0xcccccccc, unsigned long count=47) Line 188 Asm
msvcr80d.dll!memcpy_s(void * dst=0x0990e0d0, unsigned int sizeInBytes=4095, const void * src=0xcccccccc, unsigned int count=47) Line 67 + 0x11 bytes C
msvcp80d.dll!std::char_traits<char>::_Copy_s(char * _First1=0x0990e0d0, unsigned int _Size_in_bytes=4095, const char * _First2=0xcccccccc, unsigned int _Count=47) Line 575 + 0x16 bytes C++
msvcp80d.dll!std::_Traits_helper::copy_s<std::char_traits<char> >(char * _First1=0x0990e0d0, unsigned int _Size=4095, const char * _First2=0xcccccccc, unsigned int _Count=47, std::_Secure_char_traits_tag __formal={...}) Line 707 + 0x15 bytes C++
msvcp80d.dll!std::_Traits_helper::copy_s<std::char_traits<char> >(char * _First1=0x0990e0d0, unsigned int _Size=4095, const char * _First2=0xcccccccc, unsigned int _Count=47) Line 699 + 0x21 bytes C++
msvcp80d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy_s(char * _Dest=0x0990e0d0, unsigned int _Dest_size=4095, unsigned int _Count=47, unsigned int _Off=0) Line 1705 + 0x1d bytes C++
msvcp80d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::copy(char * _Dest=0x0990e0d0, unsigned int _Count=4095, unsigned int _Off=0) Line 1695 C++
CORE_DB_Magick++_.dll!Magick::Options::fileName(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & fileName_=<Bad Ptr>) Line 233 + 0x1e bytes C++
CORE_DB_Magick++_.dll!Magick::Image::read(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & imageSpec_=<Bad Ptr>) Line 1489 C++
pose.exe!testCan() Line 260 C++
pose.exe!main(int __formal=1, char * * argv=0x09a181b0) Line 81 C++
pose.exe!__tmainCRTStartup() Line 597 + 0x17 bytes C
kernel32.dll!7c817077()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
What is wrong?
- Preben
Re: Debug crash when using Visual Studio
Hey Preben,
My pre-processor directives looks like this:
WIN32;_WINDOWS;_DEBUG;OPJ_STATIC
I only have the one link lib:
"..\ImageMagick-6.5.9\VisualMagick\lib\CORE_DB_Magick++_.lib"
Plus the includes...
Then I did this:
#include "Magick++.h"
using namespace std;
using namespace Magick;
And that's about it (apart from copying the debug DLLs into my debug dir)?
I can try and create a blank project that compiles and works for you if you need it?
CYA
Steve
My pre-processor directives looks like this:
WIN32;_WINDOWS;_DEBUG;OPJ_STATIC
I only have the one link lib:
"..\ImageMagick-6.5.9\VisualMagick\lib\CORE_DB_Magick++_.lib"
Plus the includes...
Then I did this:
#include "Magick++.h"
using namespace std;
using namespace Magick;
And that's about it (apart from copying the debug DLLs into my debug dir)?
I can try and create a blank project that compiles and works for you if you need it?
CYA
Steve
Re: Debug crash when using Visual Studio
I'll just try what you've done and see what happens (tomorrow).
Did you initialize Imagemagick as described in the documentation?
http://www.imagemagick.org/Magick%2B%2B/
with
InitializeMagick(path)
Which Visual Studio version are you using?
- Preben
Did you initialize Imagemagick as described in the documentation?
http://www.imagemagick.org/Magick%2B%2B/
with
InitializeMagick(path)
Which Visual Studio version are you using?
- Preben