用VS2013建立了一個c++ console application,然后引用了一個DLL, 啟動的時候報錯:
The application was unable to start correctly (0xc000007b)
哪怕是如下最簡單的代碼也報錯:
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[]) {
return 0; } |
到底怎么回事那?
【分析】
查了這篇文章:
To start, I would suggest to test whether there is a problem between your application and its dependencies using dependency walker |
於是去下載了Dependency walker.
http://www.dependencywalker.com/
下載后打開我的項目編譯成的Exe, 結果提示無法打開,然后有如下的Log:
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module. Error: Modules with different CPU types were found. |
這個提示的意思是說CPU的架構不對。
檢查了一下,項目的設置是Win32, 然后想起我引用的那個dll是64位的。原來問題在這里。
【解決方法】
把Debug目錄引用的那個dll換成32位的,就解決了。
