注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

.

.

 
 
 

日志

 
 

0xc000007b Error Solution  

2012-06-14 05:28:27|  分类: 软件使用 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

Two days ago I was working on a C++ project using OpenCV, when suddenly my project couldn’t run anymore!

I just have changed my OpenCV dlls to parallel version and ended up with this Error: "The application was unable to start correctly (0xc000007b). Click OK to close the application." every time I tried to run my application.

0xc000007b Error Solution - foxer - .
 

 

After some hours of hard search I found that 0xc000007b error didn’t come from an exception in my code or even OpenCV dlls. I found that the error is just wrong configurations and the solution is easy, so I decided to write this article to show you how you cans solve this error permanently.

The Problem

0xc000007b error comes mainly from mixing up 32bit environment with 64bit one, that is you have an 32bit application that tries to load a 64bit dll.

To see exactly who cause this you must examine your application dependencies carefully.

I used a free portable program to do this: "Dependency Walker". After you download it you can open any PE file (exe, dll, …)

Open your application executable file (in my case "testopencv.exe") with dependency walker, you sould see something like this:

0xc000007b Error Solution - foxer - .

As You can see, dependency walker shows all dlls my application depends on, and all dlls these dlls depends on and so on…

Now you must check these dlls to see which one is 64 bit? If your application works fine you should see nothing, but when your application throws 0xc000007b error that means you have at least one 64 bit dll in these dlls.

In my case as you see, my application depends on cv2010d.dll which depends on tbb_debug.dll which is 64bit dll (notice the 64 number near its icon). You can see the properties of any dll to find its path, my tbb_debug.dll lies on: "E:\Intel\Compiler\11.154\tbb\intel64\vc9\bin".

The Solution

But why cv2010d.dll links to 64bit version of tbb_debug.dll instead of 32bit one? and how can we change that?

The answer is that most exe or dll have it is dependencies names only not their paths (that is what we called dynamic linking). So finding the real path of these dependencies done in runtime, and in our case that cause the problem.

When I run my application it tries to load cv2010d.dll which tries to load all of its dependencies including tbb_debug.dll. System tries to find tbb_debug.dll 32bit (because my application is 32bit) but when it can’t it tries to find 64bit version and it can, so it tries to load it and here is the error comes from.

To solve this I remove "E:\Intel\Compiler\11.154\tbb\intel64\vc9\bin" from the PATH variable, so when I tries to run my application system can’t find any tbb_debug.dll (neither 32bit nor 64bit version) so it throws a new error now says that tbb_debug.dll is not found.

The last step I made was coping the 32bit version of tbb_debug.dll and but it near my application executable file so now when system tries to load tbb_debug.dll it will find the 32bit version of it (also dependency walker will do that so there isn’t any 64bit dll in my dependencies now) and my application comes back to life again.

  评论这张
 
阅读(613)| 评论(0)
推荐

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017