Results 1 to 2 of 2

Thread: MFC->Qt Migration link error

  1. #1
    Join Date
    Nov 2009
    Posts
    44
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default MFC->Qt Migration link error

    I need to migrate a very large, very old MFC application to Qt. I have been working with the (excellent) migration walkthrough (walkthrough doc - highly recommended for anyone trying something similar). I am trying to replicate Step 2 - merge MFC and QT event loops and instantiate QApplication. There is an "if defined" in qmfcapp.h for _AFXDLL that enables QTWINMIGRATE_WITHMFC. If I try to compile my application with this flag (it's for compiling a DLL, I'm trying to get a .lib), it errors with undefined functions in qtmfcapp. If I compile with the standard lib flag, it compiles, but won't link. I've tried setting the link libraries to everything under the sun - including compiling them with both/neither flags. The QT Migration Walkthrough Step 2 will compile AND link ... with output as application, dll or lib. Why? I can't find any way to set my application up to behave the same way as the example! Any assistance is much appreciated.

  2. #2
    Join Date
    Nov 2009
    Posts
    44
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: MFC->Qt Migration link error

    I found at least one solution to this problem. If it helps anyone else...great! I manually defined __AFXDLL in a copy of qmfcapp.h. I set up the project inside the main solution that contains qmfcapp as multithreaded dll (C/C++ -> Code Generation). The main solution project needs to specify that the mfc libraries are loaded before CRT libraries, and you may have to add new libraries to ignore. I had to add mfc90d.lib / mfc90.lib and shift around the order of the existing libraries. I think it probably depends on how you have the old mfc project structured. Anyway, so far, it seems to work!

Similar Threads

  1. Gtk error when installing Qt in linux
    By john_god in forum Installation and Deployment
    Replies: 1
    Last Post: 18th November 2009, 06:08
  2. nmake error during .pro compiling
    By mattia in forum Installation and Deployment
    Replies: 5
    Last Post: 18th June 2008, 11:15
  3. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 14:43
  4. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 03:49
  5. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 13:19

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.