qt+osg+vs2008中(msvcr90.dll) 处最可能的异常: 0xC0000005的问题解决
2009-11-06 23:15
302 查看
用此法得到了解决。
3. 另一个运行时异常, Debug时出现:
“Unhandled exception at 0×6c1f4774 (msvcr90.dll) in TestMagick.exe: 0xC0000005: Access violation reading location 0xcccccccc.”
同样在官方论坛上找到答案:是Project属性配置引起的, Project Properties->Configuration Properties->C/C++->Code Generation->Runtime Library, 把Multi-threaded Debug DLL (/MDd)改为Multi-threaded DLL (/MD), 而/MDd是Debug的默认选项. 不过文中提到的有关”_DEBUG”改为”NDEBUG”倒不必.
在C++中使用ImageMagick(简称Magick)处理一些图片, 碰到几个问题并尝试找到了解决方案.
从Magick官方网站下载的ImageMagick-6.5.2-4-Q16-windows-dll.exe, 安装时选上C++开发包. 开发用的IDE是Visual Studio 2008.
1. Magick对中文的路径名支持不是很好, 比如
这种中文路径在OpenCV中是没问题的. 不过Magick并非不支持中文路径名, 只是需要先对中文路径进行utf-8编码. 如下面的转换代码, 在windows下通过MultiByteToWideChar和MultiByteToWideChar实现, 需要包含头文件wtypes.h, 细节可查看MSDN. 在linux下据说可以用iconv实现.
这样进行调用时, 只要:
2. 编译通过, 执行时碰到error(可在Debug模式下看到, Release下可能就直接退出了):
“Application Error
The application failed to initialize properly (0xc00000fd). Click on OK to terminate the application.”
很莫名其妙, 正常安装应该不会碰到. 重装系统后, 直接拿上次安装的dll来用就会出错这个错误. Google到答案: 因为它依赖注册表!! 重新安装一下就好了.
“The binary distribution of ImageMagick for Windows requires an installer to properly set entries in the Windows registry. What you want is an “uninstalled” version of ImageMagick. You will need to build ImageMagick from source which by default permits you to gather the binaries and configuration files into one folder and redistribute them free of dependencies on the Windows registry.”
3. 另一个运行时异常, Debug时出现:
“Unhandled exception at 0×6c1f4774 (msvcr90.dll) in TestMagick.exe: 0xC0000005: Access violation reading location 0xcccccccc.”
同样在官方论坛上找到答案:是Project属性配置引起的, Project Properties->Configuration Properties->C/C++->Code Generation->Runtime Library, 把Multi-threaded Debug DLL (/MDd)改为Multi-threaded DLL (/MD), 而/MDd是Debug的默认选项. 不过文中提到的有关”_DEBUG”改为”NDEBUG”倒不必.
“Well, I think I have it…… Turns out I didn’t quite have all the settings the same. But after a series of experiments and keeping track of all changes/differences between Debug and Release I think I’ve got it nailed down. In the “Project Properties” page, under “Configuration Properties/C++/Code Generation” make sure the “Runtime Library” is set to “Multi-Threaded DLL (/MD)” and not to “Multi-Threaded Debug DLL (/MDd)” which is the default for the Debug setup. Then under “Configuration Properties/C++/Preprocessor” you have to change the “Preprocessor Definition” that is set to “_DEBUG” to “NDEBUG”. I assume that this flag is used in the header files for the Magick++.h files somewhere. When I change these two parameters then everything works in the debug build environment.”
至于原因, 查了下MSDN, 找到这么一句话, “All modules passed to a given invocation of the linker must have been compiled with the same run-time library compiler option (/MD, /MT, /LD). “, 可能可以解释.
原文链接:http://ricoss.com/2009/05/imagemagick-tips.html
3. 另一个运行时异常, Debug时出现:
“Unhandled exception at 0×6c1f4774 (msvcr90.dll) in TestMagick.exe: 0xC0000005: Access violation reading location 0xcccccccc.”
同样在官方论坛上找到答案:是Project属性配置引起的, Project Properties->Configuration Properties->C/C++->Code Generation->Runtime Library, 把Multi-threaded Debug DLL (/MDd)改为Multi-threaded DLL (/MD), 而/MDd是Debug的默认选项. 不过文中提到的有关”_DEBUG”改为”NDEBUG”倒不必.
[转]ImageMagick中文路径名等问题解决
五月 21st, 2009在C++中使用ImageMagick(简称Magick)处理一些图片, 碰到几个问题并尝试找到了解决方案.
从Magick官方网站下载的ImageMagick-6.5.2-4-Q16-windows-dll.exe, 安装时选上C++开发包. 开发用的IDE是Visual Studio 2008.
1. Magick对中文的路径名支持不是很好, 比如
1 2 | Image img; img.read("e://头像 小头//小王.jpg"); // 读取失败 |
1 23 | // use utf8 to encode the string and store as char*. Need #include <wtypes.h>. // Not support linux, ps. iconv can do the same thing in linux. // src -- a string to be converted, may contains characters like Chinese. // return -- a point to a string which allocated in heap, it should be delete[]. char* acp2utf8(const char* src) { int len = strlen(src); int n = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0); char* res; if (len + 1 == n) { // all ascii characters, which the same as utf8 encoding string. res = new char[n]; strncpy(res, src, n); } else { WCHAR* ws = new WCHAR[n]; MultiByteToWideChar(CP_ACP, 0, src, -1, ws, n-1); ws[n-1] = 0; n = WideCharToMultiByte(CP_UTF8, 0, ws, -1, NULL, 0, NULL, NULL); res = new char[n]; WideCharToMultiByte(CP_UTF8, 0, ws, -1, res, n-1, NULL, NULL); res[n-1] = 0; delete[] ws; } return res; } |
1 23 | char* fn = acp2utf8("e://头像 小头//小王.jpg"); Image img; img.read(fn); delete[] fn; // 别忘释放内存 |
“Application Error
The application failed to initialize properly (0xc00000fd). Click on OK to terminate the application.”
很莫名其妙, 正常安装应该不会碰到. 重装系统后, 直接拿上次安装的dll来用就会出错这个错误. Google到答案: 因为它依赖注册表!! 重新安装一下就好了.
“The binary distribution of ImageMagick for Windows requires an installer to properly set entries in the Windows registry. What you want is an “uninstalled” version of ImageMagick. You will need to build ImageMagick from source which by default permits you to gather the binaries and configuration files into one folder and redistribute them free of dependencies on the Windows registry.”
3. 另一个运行时异常, Debug时出现:
“Unhandled exception at 0×6c1f4774 (msvcr90.dll) in TestMagick.exe: 0xC0000005: Access violation reading location 0xcccccccc.”
同样在官方论坛上找到答案:是Project属性配置引起的, Project Properties->Configuration Properties->C/C++->Code Generation->Runtime Library, 把Multi-threaded Debug DLL (/MDd)改为Multi-threaded DLL (/MD), 而/MDd是Debug的默认选项. 不过文中提到的有关”_DEBUG”改为”NDEBUG”倒不必.
“Well, I think I have it…… Turns out I didn’t quite have all the settings the same. But after a series of experiments and keeping track of all changes/differences between Debug and Release I think I’ve got it nailed down. In the “Project Properties” page, under “Configuration Properties/C++/Code Generation” make sure the “Runtime Library” is set to “Multi-Threaded DLL (/MD)” and not to “Multi-Threaded Debug DLL (/MDd)” which is the default for the Debug setup. Then under “Configuration Properties/C++/Preprocessor” you have to change the “Preprocessor Definition” that is set to “_DEBUG” to “NDEBUG”. I assume that this flag is used in the header files for the Magick++.h files somewhere. When I change these two parameters then everything works in the debug build environment.”
至于原因, 查了下MSDN, 找到这么一句话, “All modules passed to a given invocation of the linker must have been compiled with the same run-time library compiler option (/MD, /MT, /LD). “, 可能可以解释.
原文链接:http://ricoss.com/2009/05/imagemagick-tips.html
相关文章推荐
- 问题解决——使用CriticalSection后 0xXXXXXXXX处最可能的异常: 0xC0000005: 写入位置 0x00000014 时发生访问冲突
- 问题解决——使用CriticalSection后 0xXXXXXXXX处最可能的异常: 0xC0000005: 写入位置 0x00000014 时发生访问冲突
- EF(Entity Framework)发生错误”正在创建模型,此时不可使用上下文“的解决办法。 正在创建模型,此时不可使用上下文。如果在 OnModelCreating 方法内使用上下文或如果多个线程同时访问同一上下文实例,可能引发此异常。请注意不保证 DbContext 的实例成员和相关类是线程安全的。 临时解决了这个问题,在Context的构造函数中,禁用了自动初始化:
- 在MYSQL中,如何解决(Mysql.exe中)处有未经处理的异常:0XC0000005
- 解决当打开Unity时 提示项目已经打开,而自己之前并没有打开过(可能之前异常关闭)的问题
- VS2012 msvcr110d.dll xxxxxx处有未经处理的异常:0xC0000005:写入位置xxxxxx时发生访问冲突(scanf_s引起)-已解决
- 解决检索 COM 类工厂中 CLSID 为 {96749377-3391-11D2-9EE3-00C04F797396} 的组件失败,异常0x80040154,没有注册类问题分析和解决办法
- vs2015 系统找不到指定的文件(异常来自HRESULT:0x80070002)问题的解决方法
- 解决VC 类向导添加变量后莫名其妙出现 Unhandled exception in xxx.exe:0xC0000005:Access Violation错误的问题
- (word导出问题)解决:服务器出现意外情况。 (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT))的解决方法
- struts json 类型异常返回到js弹框问题解决办法
- 匿名内部类的参数引用只能是final,可能遇到的问题及其解决
- [转]SSAS没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)) (Microsoft Visual Studio)的解决办法
- iOS导航控制器使用interactivePopGestureRecognizer导致导航栏标题可能层次错乱的问题解决
- 解决使用OpenAI gym进行调试时抛出异常的问题
- 在SQL 2008中总是出现问题:执行Transact-SQL语句或批处理时发生异常。如何解决?
- Android 关于多点触摸抛出ArrayIndexOutOfBoundsException异常问题的解决
- 解决grails上传文件过大,发生异常的问题
- VS2010按任意键出错的解决 与 遇到了异常,可能是由某个扩展导致的
- 【解决】该任务映像已损坏或已篡改。(异常来自HRESULT:0x80041321)