2012-10-31 40 views
2

我寫了一個C程序,並在Windows 7和Linux工作正常,但是當我執行它在Windows XP中我得到的錯誤:錯誤與MSVCRT.DLL和PCRE庫

"_except_handler4_common could not be located in the dynamic link library msvcrt.dll" 

我研究了一些人們說要刪除我沒有的DLL「dwmapi.dll」,所以這不是我的問題。

有人告訴我使用depends walker(depends.exe)找到誰在使用msvcrt.dll。我做了,發現pcre庫正在使用它,實際上它有一個問題,但我不知道如何解決這個問題。誰能幫我?

這裏是什麼取決於沃克告訴我的圖像:

enter image description here

+2

是安裝在XP的機器上相應的VC-運行時可再發行?在Win7上運行的VC運行時間比WinXP上的要高出三代(甚至是SP2)。 – WhozCraig

+1

嗨,如果你的問題現在已經被下面的答案解決了,請點擊答案旁邊的勾號。否則,請提供您自己的問題答案並將其標爲正確答案。 – Chris

回答

3

原因的可能性(afaiu):

a) You linked to msvcrt.dll specifically when building - this should not happen according to Microsoft support unless you specifically do it.

b) Some other installed or copied program/driver on your XP that links to "wrong" version of msvcrl.dll is being triggered.

根據是什麼原因, 這裏是解決一些想法:

1) There might be some program/driver/etc. installation on your XP machine that has introduced "Vista/Win7 related crap" onto it. It is said (by the internets) that PCRE3.DLL belongs to "GnuWin32 Non-system processes". That means you can try to find it and rename/delete it. Or delete the program you that uses it.

2) Installing the redist for XP of the C++ redistributable that you used to build on Win7 might help. This is link for VS2005: (darn.. use google - i can only give two links per post :P)

Rebuildi NG:

3) Just build the file from sources on your XP machine using some VisualStudio version you can get on it. And check those VS project properties!

4) Fix your build on Windows7. You might be linking to _except_handler4_common in msvcrt.dll in your Windows 7 build. Make sure that you do not do that. You can specifically instruct the linker not to link to it in VisualStudio project properties "/NODEFAULTLIB:msvcrt80.lib". You also did not specify what are you using for building. VS2005, VS2008, VS2010, gcc?

回答根據的猜測和Jeffrey Tan research here

research here

+0

謝謝你,這似乎是我的問題,我現在就試試看,並告訴你它是否有效,順便說一下,我使用dev C++(gcc) – tiagoMissiato

+0

I1m對不起,但我不明白ID「據說(通過互聯網)PCRE3.DLL屬於」GnuWin32非系統進程「,這意味着你可以嘗試找到它並重命名/刪除它」,你的意思是刪除pcre3.dll?如果是的話,我不能因爲我需要使用正則expretion(pcre3.dll) – tiagoMissiato

0

(代表OP的)

的問題是與pcre3.dll,爲I」我之前告訴過,我只是改變了它的版本,我使用的版本是7.x,並改爲4.4,它調用pcre.dll而不是pcre3.dll,如果任何人有同樣的問題,這解決了我的問題。

這裏是鏈接到正確的lib: pcre-4.4-dll.zip