Qt/MFC Migration Framework with UNICODE
-
Hi experts,
We are having some difficulties with making our MFC projects (that are unicode) work with the Qt/MFC Migration Framework. We are using Qt 5.0.1 and MFC 10. We are now trying to rewrite the "step3" example from the qtwinmigrate framework source.
http://qt.gitorious.org/qt-solutions/qt-solutions/trees/master/qtwinmigrateThe step 3 example works with DEFINES -= UNICODE.
If DEFINES += UNICODE, the project does not link:
@ if not exist debug\QtPTU.exe_manifest.bak link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /MANIFEST /MANIFESTFILE:debug\QtPTU.exe.embed.manifest /OUT:debug\QtPTU.exe @C:\Users\PS\AppData\Local\Temp\QtPTU.exe.8300.8845.jom
Creating library debug\QtPTU.lib and object debug\QtPTU.exp
LINK : warning LNK4098: defaultlib 'mfc100d.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'mfcs100d.lib' conflicts with use of other libs; use /NODEFAULTLIB:library@It tries to link the non-unicode MFC libraries. So we did the following:
@QMAKE_LFLAGS += /NODEFAULTLIB:mfc100d
/NODEFAULTLIB:mfcs100d
/NODEFAULTLIB:mfc100ud
/NODEFAULTLIB:mfcs100ud
/ENTRY:"wWinMainCRTStartup"LIBS += -lmfc100ud -lmfcs100ud
LIBS += -lmfc100u -lmfcs100u@We also had to add the entry to the main function manually, since it wasn't found.
The problem we are facing now is that it crashes...
@0 AfxWinMain mfc100u 0x787e77bf
1 wWinMain appmodul.cpp 26 0xe8c16a
2 __tmainCRTStartup crtexe.c 547 0xe861ad
3 wWinMainCRTStartup crtexe.c 371 0xe85f5f
4 BaseThreadInitThunk kernel32 0x75f033aa
5 __RtlUserThreadStart ntdll32 0x77349ef2
6 _RtlUserThreadStart ntdll32 0x77349ec5@ -
It works fine here with MSVC, are you sure your project isn't Unicode? Then it off course wont work.
Few use Multibyte etc. encoding, so that makes this framework rather useless, which is a shame since it is a very good idea and tool when migrating from MFC to Qt.
-
Actually I am not sure if my project is UNICODE or not as far as Creator is concerned. I created a desktop app project so I guess it must be. I don't recall making any specific choice though. When I open it and build it with VS UNICODE is not defined in the project there but it is in Creator.
I am porting an old Windows app so the non UNICODE status is kind of temporary. I will eventually get all the code fully working with UNICODE.
As you can guess I am still a noob when it comes to using Creator and Qt. Or should I say a re-noob because I did use QT back in the past, don't ask when it will show my age :-).
Thanks for your reply anyway, I must be just missing something.