2011-05-11 165 views
2

我正在創建一個Qt應用程序,我需要在其中使用mfc dll! (我使用VS2008)如何在Qt應用程序中使用MFC dll

的Qt應用程序項目屬性: 配置類型:應用 使用標準Windows庫

這樣,當我嘗試使用MFC DLL我得到(編譯時):

fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]

如果我的MFC屬性更改爲Use MFC in a shared DLL應用構建, 但是當我嘗試運行它,我得到

Unhandled exception at 0x78a5b48a (mfc90ud.dll) in myApplication.exe: 0xC0000005: Access violation reading location 0x00000000.

任何想法的人?

謝謝!

回答

2

我想問題是你的Qt-dll是使用另一個版本的C++運行時庫而不是MFC-dll。使用兩個具有不同運行時的DLL在啓動程序時會導致崩潰。

我不知道你是否可以從源代碼重建Qt,這將是我唯一的猜測如何解決這個問題。您從MFC庫中究竟需要什麼?也許還有另一種方法去做你想做的事。