How to use a MFC dll in a Qt application
i am creating a Qt application and i need to use a mfc dll in it! (i am using vs2008)
the qt application project properties are: Configuration Type: Application Use standard windows libraries
This way, when i try to use the mfc dll i get (during build):
fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #de开发者_如何学编程fine _AFXDLL or do not use /MD[d]
If i change the mfc property to Use MFC in a shared DLL
the application builds,
but when i try to run it, i get
Unhandled exception at 0x78a5b48a (mfc90ud.dll) in myApplication.exe: 0xC0000005: Access violation reading location 0x00000000.
any ideas anyone?
Thanks!
I guess the problem is that your Qt-dll is built with another version of the C++ runtime libraries than the MFC-dll. Using two DLLs with different runtimes causes a crash when you start your program.
I don't know if you can rebuild Qt from the sources, this would be my only guess how to solve this. What exactly do you need from the MFC library? Perhaps there's another way to do what you want.
精彩评论