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. QCoreApplication::instance() is NULL

QCoreApplication::instance() is NULL

Scheduled Pinned Locked Moved General and Desktop
qt4migrationqt5
24 Posts 5 Posters 15.3k Views
  • 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.
  • S Offline
    S Offline
    sierdzio
    Moderators
    wrote on 12 Jan 2016, 09:38 last edited by
    #15

    Add

    QT -=core gui widgets
    

    to your .pro file?

    (Z(:^

    P 1 Reply Last reply 12 Jan 2016, 10:05
    0
    • S sierdzio
      12 Jan 2016, 09:38

      Add

      QT -=core gui widgets
      

      to your .pro file?

      P Offline
      P Offline
      pullmoll
      wrote on 12 Jan 2016, 10:05 last edited by
      #16

      @sierdzio said:

      Add

      QT -=core gui widgets
      

      to your .pro file?

      I first thought you were kidding me, but this even works for my main *.pro file.
      This seems a little.. umm.. counter-intuitive and the opposite of what the the help for the QT qmake variable suggests, no!?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sierdzio
        Moderators
        wrote on 12 Jan 2016, 10:19 last edited by
        #17

        Not sure what you mean.

        By default, QT contains both core and gui, ensuring that standard GUI applications can be built without further configuration.

        So, if you don't want to link them, remove them. As I understand from (brief, I admit) look at your previous comments, you aim to remove all traces of Qt libs from the project, to pinpoint the place where the release libs are injected.

        I know this might be a stupid approach, but when everything else fails... :-)

        (Z(:^

        P 1 Reply Last reply 12 Jan 2016, 10:24
        0
        • S sierdzio
          12 Jan 2016, 10:19

          Not sure what you mean.

          By default, QT contains both core and gui, ensuring that standard GUI applications can be built without further configuration.

          So, if you don't want to link them, remove them. As I understand from (brief, I admit) look at your previous comments, you aim to remove all traces of Qt libs from the project, to pinpoint the place where the release libs are injected.

          I know this might be a stupid approach, but when everything else fails... :-)

          P Offline
          P Offline
          pullmoll
          wrote on 12 Jan 2016, 10:24 last edited by
          #18

          @sierdzio said:

          Not sure what you mean.

          By default, QT contains both core and gui, ensuring that standard GUI applications can be built without further configuration.

          Yeah, sure, this has been the case since Qt4 AFAICT. I mean that removing "core gui widgets" from a main *.pro file where QMainWindow and QWigets etc. are used is counter-intuitive.

          @sierdzio said:

          So, if you don't want to link them, remove them. As I understand from (brief, I admit) look at your previous comments, you aim to remove all traces of Qt libs from the project, to pinpoint the place where the release libs are injected.

          This is a good idea at least! I would never have thought of trying to remove everything from QT execpt what is really needed (e.g. xml, network, ...).

          I know this might be a stupid approach, but when everything else fails... :-)

          Thank you for the hint. It may really help me find the bad guy :-)

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pullmoll
            wrote on 13 Jan 2016, 11:39 last edited by pullmoll
            #19

            The issue is solved!

            After an odyssey of trial and error, the culprit is or was static libraries!

            Within our project there were two submodules built as static libraries (CONFIG += static resources create_prl) and linked to several other submodules. The static libraries were built with the same project settings, i.e. DEBUG enabled, and still they were the root cause of my problems.

            It has to be either the link_prl in the project, or generally linking against static libraries which causes our project to import the unwanted non-debug Qt5-DLLs in a debug build.

            After converting the static libraries to DLLs with export symbols now everything works as expected.

            I don't know if this problem and its workaround should be considered a Qt5 bug, or if it is my fault because of not having read some documentation part mentioning this specific fact?

            Thanks for all your help and cheers!
            Jürgen

            1 Reply Last reply
            1
            • S Offline
              S Offline
              sierdzio
              Moderators
              wrote on 13 Jan 2016, 11:52 last edited by
              #20

              Nice.

              You might want to ask this on Qt development mailing list, the Qt core developers could probably comment on that weird release symbol linking.

              (Z(:^

              1 Reply Last reply
              1
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 13 Jan 2016, 14:23 last edited by
                #21

                Since I don't know if you are using a shadow build, are you using the same names for your static debug release libraries ? Are you putting them in the same folder ?

                If so you might be linking to a release version of your lib accidentally which in turn would pull the release Qt libraries.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                P 1 Reply Last reply 13 Jan 2016, 15:18
                0
                • P Offline
                  P Offline
                  pullmoll
                  wrote on 13 Jan 2016, 15:16 last edited by pullmoll
                  #22

                  After posting to Qt development ML and getting a reply, an even simpler solution is to just

                  CONFIG -= debug_and_release
                  

                  in the *.pro files of the staticlib submodules. I don't know why, but debug_and_release seems to be a default. My project, developed with QtCreator since Qt4, doesn't define this flag.

                  1 Reply Last reply
                  1
                  • S SGaist
                    13 Jan 2016, 14:23

                    Since I don't know if you are using a shadow build, are you using the same names for your static debug release libraries ? Are you putting them in the same folder ?

                    If so you might be linking to a release version of your lib accidentally which in turn would pull the release Qt libraries.

                    P Offline
                    P Offline
                    pullmoll
                    wrote on 13 Jan 2016, 15:18 last edited by
                    #23

                    @SGaist said:

                    If so you might be linking to a release version of your lib accidentally which in turn would pull the release Qt libraries.

                    I'm using QtCreator and have separate shadow build directories for debug and release. The culprit was the debug_and_release flag in CONFIG which I have to remove in the *.pro files...

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 13 Jan 2016, 22:02 last edited by
                      #24

                      Still a bit strange but glad you found a solution :)

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      24/24

                      13 Jan 2016, 22:02

                      • Login

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