Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. LInk Qt framework to an MFC project
Forum Updated to NodeBB v4.3 + New Features

LInk Qt framework to an MFC project

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 2 Posters 4.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrjjM mrjj

    Hi
    it would be helpful if you show the actual linker errors.

    And why an MFC project?
    That normally do not link to the needed Qt dlls.

    Also why did you compiled your own Qt?
    Is is static or what is special about it?

    mandruk1331M Offline
    mandruk1331M Offline
    mandruk1331
    wrote on last edited by mandruk1331
    #3

    @mrjj
    Error 2 error LNK2019: unresolved external symbol "_declspec(dllimport) public: virtual __thiscall QMessageBox::~QMessageBox(void)" (__imp??1QMessageBox@@UAE@XZ) referenced in function "public: virtual void * __thiscall QMessageBox::`scalar deleting destructor'(unsigned int)" (??_GQMessageBox@@UAEPAXI@Z)

    It's just for learning. I have an MFC old project (used it for learning MFC) and now I just want to use the Qt ui in MFC project, to learn something new. No, the application is not static. So compiling was not a good idea(
    in the InitInstance fucntion (MFC) I'm just trying to create a QMessageBox: QMessageBox *p = new QMessageBox

    Mandruk1331

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Hi
      Ok seems you are not linking to the Qt dlls.
      Also how will you handle the event loop?
      Do you create a QApplication object also?

      Mixed MFC and Qt might be really hard.

      mandruk1331M 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        Ok seems you are not linking to the Qt dlls.
        Also how will you handle the event loop?
        Do you create a QApplication object also?

        Mixed MFC and Qt might be really hard.

        mandruk1331M Offline
        mandruk1331M Offline
        mandruk1331
        wrote on last edited by mandruk1331
        #5

        @mrjj No I'm not creating a QApplication object. Do I have to create it in order to make a test QMesssageBox?
        I red that creating a secondary thread solves the issue, and also I checked that I will have to re-write the MFC signals so that Qt UI would be able to catch them. But in fact I do link to them, In visual studio I set the Reference path to the Qt\bin folder, also I have installed Qt visual studio plugin

        Mandruk1331

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #6

          Hi
          Yep you need QApp
          alt text

          The visual studio plugin is not ment for MFC projects. not sure it
          work with that. never tried.

          The error says its not linked. So check compiler output etc and see if you can spot something.

          mandruk1331M 1 Reply Last reply
          0
          • mrjjM mrjj

            Hi
            Yep you need QApp
            alt text

            The visual studio plugin is not ment for MFC projects. not sure it
            work with that. never tried.

            The error says its not linked. So check compiler output etc and see if you can spot something.

            mandruk1331M Offline
            mandruk1331M Offline
            mandruk1331
            wrote on last edited by
            #7

            @mrjj that's a run-time error. And I have a compile time, I mean that even If i'll create a Qapplication object nothing changes. Why it does not see the dll? Have you tried to connect Qt to MFC? Thanks in advance.

            Mandruk1331

            mrjjM 1 Reply Last reply
            0
            • mandruk1331M mandruk1331

              @mrjj that's a run-time error. And I have a compile time, I mean that even If i'll create a Qapplication object nothing changes. Why it does not see the dll? Have you tried to connect Qt to MFC? Thanks in advance.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #8

              That is what happens if i make a msg box before the application.
              You will get the same if it linked and ran.

              Sadly i never tried to mix MFC and Qt as what would be the point?
              Both are for GUI so one is enough.

              But i understand you do it for learning. I dont have visual studio IDE so cannot tell you
              if you have added it to the right place.
              http://www.technical-recipes.com/2012/how-to-link-dlls-to-c-projects/

              You could post some images of the dialogs involved and hope that someone can spot
              what is wrong.

              mandruk1331M 2 Replies Last reply
              0
              • mrjjM mrjj

                That is what happens if i make a msg box before the application.
                You will get the same if it linked and ran.

                Sadly i never tried to mix MFC and Qt as what would be the point?
                Both are for GUI so one is enough.

                But i understand you do it for learning. I dont have visual studio IDE so cannot tell you
                if you have added it to the right place.
                http://www.technical-recipes.com/2012/how-to-link-dlls-to-c-projects/

                You could post some images of the dialogs involved and hope that someone can spot
                what is wrong.

                mandruk1331M Offline
                mandruk1331M Offline
                mandruk1331
                wrote on last edited by
                #9

                @mrjj at first I'll try to link Qt libs to a console application, and after will continue with MFC

                Mandruk1331

                1 Reply Last reply
                0
                • mrjjM mrjj

                  That is what happens if i make a msg box before the application.
                  You will get the same if it linked and ran.

                  Sadly i never tried to mix MFC and Qt as what would be the point?
                  Both are for GUI so one is enough.

                  But i understand you do it for learning. I dont have visual studio IDE so cannot tell you
                  if you have added it to the right place.
                  http://www.technical-recipes.com/2012/how-to-link-dlls-to-c-projects/

                  You could post some images of the dialogs involved and hope that someone can spot
                  what is wrong.

                  mandruk1331M Offline
                  mandruk1331M Offline
                  mandruk1331
                  wrote on last edited by mandruk1331
                  #10

                  @mrjj did you link Qt to a Visual Studio console project? If yes how did you do that, because I'm having problems with it. Thank you
                  UPD: got it working.
                  But receiving this error:
                  This application failed to start because it could not find or load the Qt platform plugin "windows"
                  in "".

                  Mandruk1331

                  mrjjM 1 Reply Last reply
                  0
                  • mandruk1331M mandruk1331

                    @mrjj did you link Qt to a Visual Studio console project? If yes how did you do that, because I'm having problems with it. Thank you
                    UPD: got it working.
                    But receiving this error:
                    This application failed to start because it could not find or load the Qt platform plugin "windows"
                    in "".

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    @mandruk1331

                    Yes the link shows how the author links a dlls to his project.
                    But its 2010 VS so dialog might have changed.

                    1 Reply Last reply
                    0
                    • mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      @mandruk1331 said in LInk Qt framework to an MFC project:

                      This application failed to start because it could not find or load the Qt platform plugin "windows"

                      That is because it cant find the dlls.
                      very normal case when people click the .exe outside of creator.

                      mandruk1331M 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @mandruk1331 said in LInk Qt framework to an MFC project:

                        This application failed to start because it could not find or load the Qt platform plugin "windows"

                        That is because it cant find the dlls.
                        very normal case when people click the .exe outside of creator.

                        mandruk1331M Offline
                        mandruk1331M Offline
                        mandruk1331
                        wrote on last edited by
                        #13

                        @mrjj I have connected Qt to MFC. Thank you! It now compiles and works

                        Mandruk1331

                        1 Reply Last reply
                        1

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved