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. [Solved] Cannot build a project on Mac OSX: error: no member named 'isDetached' in 'QDebug'
Forum Updated to NodeBB v4.3 + New Features

[Solved] Cannot build a project on Mac OSX: error: no member named 'isDetached' in 'QDebug'

Scheduled Pinned Locked Moved General and Desktop
14 Posts 3 Posters 3.4k 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.
  • K Offline
    K Offline
    kerkil
    wrote on last edited by
    #1

    Hi there,

    I am trying to compile a project on Mac OSX Mavericks. My Qt version is 5.2.1. (I have Xcode5.1 installed.)

    While I build the project, I get these errors:

    In file included from ../../../../../Qt/5.2.1/clang_64/lib/QtCore.framework/Versions/5/Headers/QDebug:1:
    ../../../../../Qt/5.2.1/clang_64/lib/QtCore.framework/Versions/5/Headers/qdebug.h:73:9: error: unknown type name 'QMessageLogContext'
    QMessageLogContext context;
    ^
    ../../../../../Qt/5.2.1/clang_64/lib/QtCore.framework/Versions/5/Headers/qdebug.h:132:1: error: no member named 'isDetached' in 'QDebug'
    Q_DECLARE_SHARED(QDebug)
    ^~~~~~~~~~~~~~~~~~~~~~~~
    /usr/local/include/QtCore/qglobal.h:2215:63: note: expanded from macro 'Q_DECLARE_SHARED'
    template <> inline bool qIsDetached<TYPE>(TYPE &t) { return t.isDetached(); }
    ~ ^

    Could someone please help me understand what is causing these errors mean and how to proceed to resolve/fix these errors?
    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What kind of project ?

      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
      • K Offline
        K Offline
        kerkil
        wrote on last edited by
        #3

        Hi I think it is a Qt application project. I am a Qt and programming novice, and so I am not sure if my answer is correct. Is there a way to check what kind of project it is?

        I am adding a few classes to a pre-existing large project that I receive from my colleagues who are not available at the moment. The project makes a UI and I do some scientific computations for producing some graphics for UI - not sure if this helps.

        Thanks for your help!

        1 Reply Last reply
        0
        • A Offline
          A Offline
          ambershark
          wrote on last edited by
          #4

          I noticed your Qt path is /usr/local/include/QtCore. Is this really how you installed Qt?

          Normally Qt would be installed to say the /usr/local/ prefix but it would be put into something like /usr/local/Qt-5.2.1. Then includes would be gathered from the QTDIR environment variable and directly from qmake settings which you can see with qmake -query.

          Anyway, my idea behind this is it's possible you are compiling against a different version of Qt than you expect. Perhaps some version that was installed by some other piece of software. I've never seen Qt installed inside /usr/local/include / lib like that on any posix system.

          I've had that happen to me on a linux system before when I wasn't paying attention and it tried to use the existing Qt4 that was installed with KDE instead of the Qt4 that I had wanted it to use.

          My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            How do you open the project ?

            Are you sure it's a Qt 5 ready project ?

            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
            • K Offline
              K Offline
              kerkil
              wrote on last edited by
              #6

              Yes, I actually have built it OK previously - identical project. Recently, I have installed some python and GPU related stuff for doing some other stuff. When I try to build the same project again today, it all happened. I am positive that it is a Qt 5 ready project.

              What I do not understand is that my colleague checked out the same project and built it OK on his Macbook. He does not have the issue with QMessageLogContext being an unknown type. That method seems to be in qlogging.h, which I also have, but for some reason, Qt does not show it as highlighted. I wonder if it is related to configuration issues.

              I am opening the project by opening the .pro file for the project.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                ambershark
                wrote on last edited by
                #7

                That just makes me think even more that you are using 2 versions of Qt. That is the exact behavior I've seen when that is the problem.

                Oh and just for fun, I would run:

                1. make distclean
                2. qmake
                3. make

                Sometimes just cleaning the project fixes weird include issues like that.

                My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kerkil
                  wrote on last edited by
                  #8

                  Thanks for your answer, ambershark.
                  I just ran "make distclean," and qmake and make again.
                  The errors don't seem to change.

                  To make sure, I ran "make distclean" by changing Projects->Clean Steps->Make arguments from clean to distclean. Then, I ran "Run Qmake" and then rebuilt it. Did I do what you suggested correctly?

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    ambershark
                    wrote on last edited by
                    #9

                    That should be fine. Are you using Qt Creator? Or some other GUI? I was assuming command line which I really shouldn't do since it seems most people don't use it. :)

                    My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      kerkil
                      wrote on last edited by
                      #10

                      Yes, I am using Qt Creator and run Qt5.2.1. I am checking if I can find another version of Qt hiding somewhere in the system. Is there a setting or configuration that I can check or clean for Qt?

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        ambershark
                        wrote on last edited by
                        #11

                        [quote author="kerkil" date="1403805176"]Hi there,

                        I am trying to compile a project on Mac OSX Mavericks. My Qt version is 5.2.1. (I have Xcode5.1 installed.)

                        While I build the project, I get these errors:

                        In file included from ../../../../../Qt/5.2.1/clang_64/lib/QtCore.framework/Versions/5/Headers/QDebug:1:
                        ../../../../../Qt/5.2.1/clang_64/lib/QtCore.framework/Versions/5/Headers/qdebug.h:73:9: error: unknown type name 'QMessageLogContext'
                        QMessageLogContext context;
                        ^
                        ../../../../../Qt/5.2.1/clang_64/lib/QtCore.framework/Versions/5/Headers/qdebug.h:132:1: error: no member named 'isDetached' in 'QDebug'
                        Q_DECLARE_SHARED(QDebug)
                        ^~~~~~~~~~~~~~~~~~~~~~~~
                        /usr/local/include/QtCore/qglobal.h:2215:63: note: expanded from macro 'Q_DECLARE_SHARED'
                        template <> inline bool qIsDetached<TYPE>(TYPE &t) { return t.isDetached(); }
                        ~ ^

                        Could someone please help me understand what is causing these errors mean and how to proceed to resolve/fix these errors?
                        Thanks![/quote]

                        OK, so what I said earlier about 2 different Qt versions seems correct now that I looked at your paths in more detail. If you look at the error it is using the framework for the includes:

                        ../../../../../Qt/5.2.1/clang_64/lib/QtCore.framework/Versions/5/Headers/qdebug.h

                        BUT, later on in the build it fails because it included a file from:

                        /usr/local/include/QtCore/qglobal.h

                        Just for fun you might try moving/locking/removing your /usr/local/include/Qt* directories.

                        Be very careful if you choose to remove, something put them there so you will be breaking some other app. What I would do to test this easily is change the permissions so your build can't access them.

                        On a command line (command+space -> terminal):

                        sudo chmod 000 /usr/local/include/Qt*

                        Then try the build. Let me know how it goes, it will probably work.

                        To restore your permissions:

                        sudo chmod 755 /usr/local/include/Qt*

                        If the build works I can help you with a real solution, if it doesn't, post the build log here.

                        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          kerkil
                          wrote on last edited by
                          #12

                          Thanks, ambershark for your help!

                          It fixed the problem! I'd love to learn the real solution so that when this comes back I can fix it by myself!

                          Thanks a lot and looking forward to learning a real solution.

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            ambershark
                            wrote on last edited by
                            #13

                            Ah great news!

                            The solution to your problem is to make sure that your code uses only the includes and libs from your framework and doesn't check the system paths for includes.

                            To do this with Qt Creator I would have to play around with it. I don't even have it installed right now. But basically you are checking for anything that might set an include path to /usr/local/include. This is sometimes set system wide. It can also be set in CFLAGS/CXXFLAGS environment variables, as well as a few other places.

                            I'm guessing based on what happened that it is set system wide for you, just a guess though. I would try to figure out what program installed Qt in a system directory like that as it is just going to continue causing you problems.

                            The problem is basically that /usr/local/include is before your framework include in the path. This causes the compiler to use the headers in /usr/local/include/QtCore rather than the one you expected from the framework.

                            Solving this problem on your specific system may be difficult. I think my approach if this was my system would be to identify the application that installed the rogue Qt at /usr/local/include and find a fix for that. As a temporary solution you could move all /usr/local/include/Qt* to a backup directory until you find the culprit. Be sure to check for Qt libs in other system places like /usr/local/lib. Something like:

                            cd /
                            find . -iname "libqtcore*.so*"

                            That should report any qt lib on your system. Anything in a path you don't think should be there should be moved to a backup directory until you find who uses it. This would be things like /usr/lib /usr/local/lib, etc. It would not include framework paths or wherever you actually installed your legit Qt.

                            It's also possible your project sets INCLUDEPATH to have /usr/local/include in it. This can be taken out and may solve the problem.

                            Anway, there are a lot of ways for things to turn out like this and I can't pretend to figure them all out on your system without being able to look around, so my info from above should give you the reasons and some ideas on how to fix but actually finding the specific problem on your system is going to be up to you in the long run.

                            Good luck! :) At least you can build for now to get your work done. You can always figure the rest out later.

                            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                            1 Reply Last reply
                            0
                            • K Offline
                              K Offline
                              kerkil
                              wrote on last edited by
                              #14

                              Thank you so much, ambershark. I will definitely explore the solutions you suggest, and I agree that at least for now I can focus on getting my work done and always figure things out later! Thanks again for your kind, detailed help!

                              1 Reply Last reply
                              0

                              • Login

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