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] Build problems switching from Qt 5.3 to Qt 5.4 - Get redeclaration and redefinition errors
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Build problems switching from Qt 5.3 to Qt 5.4 - Get redeclaration and redefinition errors

Scheduled Pinned Locked Moved General and Desktop
14 Posts 4 Posters 4.3k 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.
  • F Offline
    F Offline
    Florian.Preiss
    wrote on last edited by
    #1

    Hi,

    when try to complie with new Qt 5.4 our project won't build. (Qt 5.3 is well working)
    Using Qt for Windows, Desktop Application, MinGW 32bit 4.9.1

    We got

    redeclaration of 'QML_HAS_ATTACHED_PROPERTIES' QML_HAS_ATTACHED_PROPERTIES = 0x01

    in qdeclarative.h Line 61

    many errors like

    redefinition of 'template<class T> int qmlRegisterUncreatableType(const char*, int, int, const char*, const QString&)'
    int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason)

    ^

    also from qdeclarative.h

    some

    _redefinition of 'struct QMetaTypeId<QObject*>'
    struct QMetaTypeId< TYPE > _
    ^
    in qmetatype.h

    Didn't found these issues already discussed so i hope someone can help. Right now I've no idea.
    Thought leap from 5.3 to 5.4 shouldn't be such a problem.

    Thanks,
    Florian

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi, and welcome to the Qt Dev Net!

      Did you clean your build directory before switching versions?

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Florian.Preiss
        wrote on last edited by
        #3

        Hi there,

        yes, we did.
        We also (re)installed Qt 5.4 and updating to new QtCreator 3.3.
        Didn't helped.

        New projects or demo projects build well with new Qt .5.4.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Please try to remove old Makefiles in addition to your cleaning.

          (Z(:^

          1 Reply Last reply
          0
          • F Offline
            F Offline
            Florian.Preiss
            wrote on last edited by
            #5

            We already did that too.

            We just used the "raw" source codes files an try to build.
            No make, moc, or what ever (should) have been left from old Qt 5.3 build.

            Same problems...

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Rondog
              wrote on last edited by
              #6

              I haven't see this. I use almost the identical configuration except for my version of MinGW, 4.8.2 in my case. I build from source.

              Is your copy of MinGW the one provided with Qt 5.4.0?

              Do you still have the previous version of Qt (5.3) on the same computer? Is it possible that you are mixing between the two versions of MinGW (i.e. using the new compiler but including headers or other files from the old version?).

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Florian.Preiss
                wrote on last edited by
                #7

                The MinGW 4.9.1 comes from the Qt maintenance tool / package updater. Bundled to the Qt 5.4 Version

                I do have both Qt Version on my system an i can switch between the severals build kits inside Qt Creator.

                Qt 5.3 with MinGW 4.8.2 works, Qt 5.4 with MinGW 4.9.1 didn't.

                Well, I'll try to test Qt 5.4 with the old MinGW 4.8.2 Version...

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  Rondog
                  wrote on last edited by
                  #8

                  I could try the same (update MinGW to 4.9.1) to verify. I have never had a problem with past versions of MinGW so I am skeptical that this is the cause.

                  It is not as easy as switching MinGW. Qt would need to be re-compiled to be sure there is no other side effects.

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    Florian.Preiss
                    wrote on last edited by
                    #9

                    Just tried a fresh Qt 5.4 Installation with only MinGW 4.9.1...

                    Same problem...

                    Damm, I have no idea at all what's the problem....

                    1 Reply Last reply
                    0
                    • JKSHJ Offline
                      JKSHJ Offline
                      JKSH
                      Moderators
                      wrote on last edited by
                      #10

                      I just noticed that the problem header is qdeclarative.h.

                      Are you mixing Qt Quick 1 with Qt Quick 2? If so, stick to one version only (preferably Qt Quick 2), and remove all traces of the other version from your code. Mixing versions isn't supported.

                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                      1 Reply Last reply
                      0
                      • F Offline
                        F Offline
                        Florian.Preiss
                        wrote on last edited by
                        #11

                        Well, we use several QML-Files and we do mix QtQuick 2.0 / 2.1 and 2.2....

                        But no Qt Quick 1.0 as far as I can see...

                        Mixing Qt Quick 2.x also a problem ?

                        1 Reply Last reply
                        0
                        • JKSHJ Offline
                          JKSHJ Offline
                          JKSH
                          Moderators
                          wrote on last edited by
                          #12

                          [quote author="Florian.Preiss" date="1424354633"]But no Qt Quick 1.0 as far as I can see...[/quote]Do you use any classes that are called QDeclarative[X]? If so, you need to replace them with QQml[X] or QQuick[X].

                          Look through your error messages again. How is qdeclarative.h getting included in your project?

                          [quote author="Florian.Preiss" date="1424354633"]Mixing Qt Quick 2.x also a problem ?[/quote]Mixing Qt Quick 2.x should be fine, AFAIK.

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          1 Reply Last reply
                          0
                          • F Offline
                            F Offline
                            Florian.Preiss
                            wrote on last edited by
                            #13

                            The hint with "decalrative.h" has finally solved the issue or at least helped to identify the problem.

                            We hade two classes which used "QDevlarativeItem" like this

                            printsystem_controller::printsystem_controller(QDevlarativeItem *parent) :

                            We changed it to

                            printsystem_controller::printsystem_controller(QObject *parent) :

                            and the build works.
                            Fortunately there was no need for "QDevlarativeItem" at this point.

                            We then hat also this problem

                            "https://bugreports.qt.io/browse/QTBUG-43797":https://bugreports.qt.io/browse/QTBUG-43797

                            but there we could change the settings of the CentralWidget to make it work.

                            Thanks for helping

                            1 Reply Last reply
                            0
                            • sierdzioS Offline
                              sierdzioS Offline
                              sierdzio
                              Moderators
                              wrote on last edited by
                              #14

                              QDeclarativeItem has been replaced by QQuickItem in QtQuick 2.

                              (Z(:^

                              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