Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt template specialization error and linking issues
Qt 6.11 is out! See what's new in the release blog

Qt template specialization error and linking issues

Scheduled Pinned Locked Moved Qt Creator and other tools
17 Posts 3 Posters 8.1k 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.
  • A Offline
    A Offline
    apreddy
    wrote on last edited by
    #1

    Hi everyone,

    I have been trying to migrate a qt 4 mingw built project into qt 5.2.1 and i am encountering the following issues
    @C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore\qflags.h:47: In file included from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include/QtCore/qflags.h:47:0,
    C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore\qglobal.h:1038: from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include/QtCore/qglobal.h:1038,
    C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore\qatomic.h:42: from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include/QtCore/qatomic.h:42,
    C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore\qvariant.h:45: from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore/qvariant.h:45,
    C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore\QVariant:1: from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include/QtCore/QVariant:1,
    C:\Users\alpha image\Desktop\black\build-black-Desktop_Qt_5_2_1_MinGW_32bit-Debug\ui_blackmainwindow.h:12: from ./ui_blackmainwindow.h:12,
    C:\Users\alpha image\Desktop\black\black\blackmainwindow.h:6: from debug../../black/blackmainwindow.h:6,
    C:\Users\alpha image\Desktop\black\build-black-Desktop_Qt_5_2_1_MinGW_32bit-Debug\debug\moc_blackmainwindow.cpp:9: from debug\moc_blackmainwindow.cpp:9:
    C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore\qtypeinfo.h:190: error: template specialization with C linkage
    template<>
    ^
    C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore\quuid.h:214: in expansion of macro 'Q_DECLARE_TYPEINFO'
    Q_DECLARE_TYPEINFO(QUuid, Q_PRIMITIVE_TYPE);
    ^
    C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore\QUuid:1: In file included from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore/QUuid:1:0,
    C:\Users\alpha image\Desktop\black\meta\mark.h:5: from ..\meta/mark.h:5,
    C:\Users\alpha image\Desktop\black\meta\track.h:6: from ..\meta/track.h:6,
    C:\Users\alpha image\Desktop\black\process\deinterlacerprocess.h:17: from ..\black/../manager/../process/deinterlacerprocess.h:17,
    C:\Users\alpha image\Desktop\black\manager\processmanager.h:8: from ..\black/../manager/processmanager.h:8,
    C:\Users\alpha image\Desktop\black\black\blackframewidget.h:8: from ..\black/blackframewidget.h:8,
    C:\Users\alpha image\Desktop\black\build-black-Desktop_Qt_5_2_1_MinGW_32bit-Debug\ui_blackmainwindow.h:27: from ./ui_blackmainwindow.h:27,
    C:\Users\alpha image\Desktop\black\black\blackmainwindow.h:6: from debug../../black/blackmainwindow.h:6,
    C:\Users\alpha image\Desktop\black\build-black-Desktop_Qt_5_2_1_MinGW_32bit-Debug\debug\moc_blackmainwindow.cpp:9: from debug\moc_blackmainwindow.cpp:9:
    C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore\quuid.h:222: error: declaration of C function 'QDebug operator<<(QDebug, const QUuid&)' conflicts with
    Q_CORE_EXPORT QDebug operator<<(QDebug, const QUuid &);
    ^
    C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore\quuid.h:217: error: previous declaration 'QDataStream& operator<<(QDataStream&, const QUuid&)' here
    Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUuid &);
    ^@

    Here is the compiler output for reference if that could help .
    @

    In file included from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include/QtCore/qflags.h:47:0,
    from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include/QtCore/qglobal.h:1038,
    from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include/QtCore/qatomic.h:42,
    from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore/qvariant.h:45,
    from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include/QtCore/QVariant:1,
    from ./ui_blackmainwindow.h:12,
    from debug../../black/blackmainwindow.h:6,
    from debug\moc_blackmainwindow.cpp:9:
    ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include/QtCore/qtypeinfo.h:190:1: error: template specialization with C linkage
    template<>
    ^
    ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore/quuid.h:214:1: note: in expansion of macro 'Q_DECLARE_TYPEINFO'
    Q_DECLARE_TYPEINFO(QUuid, Q_PRIMITIVE_TYPE);
    ^
    In file included from ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore/QUuid:1:0,
    from ..\meta/mark.h:5,
    from ..\meta/track.h:6,
    from ..\black/../manager/../process/deinterlacerprocess.h:17,
    from ..\black/../manager/processmanager.h:8,
    from ..\black/blackframewidget.h:8,
    from ./ui_blackmainwindow.h:27,
    from debug../../black/blackmainwindow.h:6,
    from debug\moc_blackmainwindow.cpp:9:
    ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore/quuid.h:222:54: error: declaration of C function 'QDebug operator<<(QDebug, const QUuid&)' conflicts with
    Q_CORE_EXPORT QDebug operator<<(QDebug, const QUuid &);
    ^
    ..........\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore/quuid.h:217:28: error: previous declaration 'QDataStream& operator<<(QDataStream&, const QUuid&)' here
    Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUuid &);
    ^
    Makefile.Debug:11448: recipe for target 'debug/moc_blackmainwindow.o' failed
    mingw32-make[1]: *** [debug/moc_blackmainwindow.o] Error 1
    mingw32-make[1]: Leaving directory 'C:/Users/alpha image/Desktop/black/build-black-Desktop_Qt_5_2_1_MinGW_32bit-Debug'
    makefile:34: recipe for target 'debug' failed
    mingw32-make: *** [debug] Error 2
    15:36:08: The process "C:\Qt\Qt5.2.1\Tools\mingw48_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project black (kit: Desktop Qt 5.2.1 MinGW 32bit)
    When executing step 'Make'
    15:36:08: Elapsed time: 00:07.@

    I was able to build and run this project using qt4.8 initially. any ideas as to what i should check to make it work are welcome.

    Regards

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      Could you show us what do you have in blackmainwindow.h

      1 Reply Last reply
      0
      • A Offline
        A Offline
        apreddy
        wrote on last edited by
        #3

        Hi Thanks for the reply
        @#ifndef BLACKMAINWINDOW_H
        #define BLACKMAINWINDOW_H

        #include <ui_blackmainwindow.h>
        #include <QDataStream>

        namespace Ui {
        class blackMainWindow;
        }

        class blackMainWindow : public QMainWindow, private Ui::blackMainWindow
        {
        Q_OBJECT

        public:
        explicit blackMainWindow(QWidget *parent = 0);
        ~blackMainWindow();

        private:

        playerWidget* blackFramePlayerWidget;
        
        QPushButton* showHideConfigurationButton;
        
        QScrollArea* scrollArea;
        
        MediaFile_ptr sourceFilePointer;
        
        QSharedPointer<Track> detectedBlackTrack;
        QSharedPointer<Track> detectedShotTrack;
        
        MetadataBundle *metaDataBundle;
        
        QString sourceFilePath;
        
        QSharedPointer<Timecode> startTimecode;
        QSharedPointer<Timecode> endTimecode;
        
        fileInfo_t fileInfo;
        
        bool runningBlackFrameDetection;
        bool runningShotDetection;
        

        signals:

        void setupFileSignal(QString);
        
        void startBlackFrameDetectionSignal(QSharedPointer<Track>);
        void startShotDetectionSignal(QSharedPointer<Track>);
        
        void startGeneratingXMLSignal(QString, MetadataBundle*);
        
        void clearAllSignal();
        
        void loadProfilesSignal();
        
        void checkForAutomaticDetectionSignal();
        

        public slots:

        void chooseConfigurationTabToShow(int index);
        void showHideConfigurationWidget(bool checked);
        
        void chooseSettingsTabToShow(int index);
        
        void chooseAnalysisTabToShow(int index);
        
        void openFile&#40;QString filePath&#41;;
        
        void setBlackTrackOnPlayer();
        void setBlackTrackOnAnalysisWidget();
        void setShotTrackOnPlayer();
        void setShotTrackOnAnalysisWidget();
        
        void detectBlackFrames();
        void detectBlackFramesFinished();
        
        void detectShots();
        void detectShotsFinished();
        
        void generateXMLReport();
        
        QString getBaseNameOfDpxFile&#40;QString file&#41;;
        

        };

        #endif @

        I hope this helps

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

          Nothing suspicious is here.
          You did re-generate ui_blackmainwindow.h with Qt5.2.1, right?
          Could you show please part of ui_blackmainwindow.h that is related to QUuid.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            apreddy
            wrote on last edited by
            #5

            yeah i did regenerate the ui_blackmainwindow.h
            I cleaned the project and then ran qmake and then built the project
            @#ifndef UI_BLACKMAINWINDOW_H
            #define UI_BLACKMAINWINDOW_H

            #include <QtCore/QVariant>
            #include <QtWidgets/QAction>
            #include <QtWidgets/QApplication>
            #include <QtWidgets/QButtonGroup>
            #include <QtWidgets/QDockWidget>
            #include <QtWidgets/QFrame>
            #include <QtWidgets/QHBoxLayout>
            #include <QtWidgets/QHeaderView>
            #include <QtWidgets/QMainWindow>
            #include <QtWidgets/QMenuBar>
            #include <QtWidgets/QPushButton>
            #include <QtWidgets/QSpacerItem>
            #include <QtWidgets/QStackedWidget>
            #include <QtWidgets/QVBoxLayout>
            #include <QtWidgets/QWidget>
            #include "blackframewidget.h"
            #include "blackinfowidget.h"
            #include "blacksettingswidget.h"
            #include "blackshotsettingswidget.h"
            #include "blackshotwidget.h"
            #include "blacksourcewidget.h"
            #include "blackxmlsettingswidget.h"
            #include "blackxmlwidget.h"
            @

            actually the quuid stuff resides in another source file which is then added to the header here is an instance.
            @void blackSettingsWidget::saveSettings()
            {
            QUuid blackFrameId;
            QString blackFrameName = blackFrameProfileNameLineEdit->text();
            int blackFrameIndex = blackFrameProfileComboBox->findText(blackFrameName);

            if (blackFrameIndex == -1)
            {
                blackFrameId = QUuid::createUuid();
                blackFrameProfileComboBox->addItem(blackFrameName, blackFrameId.toString());
            }
            else
            {
                blackFrameId = QUuid(blackFrameProfileComboBox->itemData(blackFrameIndex).toString());
            }
            
            //TO DO
            verifyBlackFrameSettings();
            
            saveBlackFrameSettings(blackFrameId, blackFrameName);
            blackFrameProfileComboBox->setCurrentIndex(blackFrameProfileComboBox->findText(blackFrameName));
            
            setupBlackFrameSettings(blackFrameId);
            
            returnBlackSettingsToNormal();
            
            emit reloadBlackFrameProfilesSignal();
            

            }

            void blackSettingsWidget::saveBlackFrameSettings(QUuid id, QString name)
            {
            blackFrameParameters* parametersB= new blackFrameParameters();
            blackFrameSettings* blackFrame = new blackFrameSettings(parametersB);

            blackFrame->setId(id);
            blackFrame->setName(name);
            blackFrame->setDetectBlackOption(automaticallyDetectBlackFramesCheckBox->checkState());
            blackFrame->setDetectBlackLevel(detectBlackLevelLineEdit->text().toUInt());
            blackFrame->setDetectBlackFrameMinimum(detectBlackMimimumFramesLineEdit->text().toUInt());
            blackFrame->setDetectBlackMethod(detectBlackMethodComboBox->currentIndex());
            
            int setB = dataBasePointer->setSettingInDataBase(parametersB, dataBase::BLACKFRAME);
            if (setB)
            {
                QMessageBox::critical(this, tr("Error"), tr("Data Base Error.\n\n%1").arg(dataBasePointer->warningErrorMessage));
            
                return;
            }
            

            }@

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andreyc
              wrote on last edited by
              #6

              You do not use extern "C" anywhere, right?

              I created a small project with QUuid and I was not able to reproduce the problem.
              I build it in Qt 4.8.5, 5.2.1, and 5.3.0

              I guess you will need to comment out the suspicious lines one by one and try to find what particular line cause this error.

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

                i tried doing that .. but unfortunately i had like a lot of errors. that too in the in the qt header files ...so i suspect what i am doing is wrong.. another thing to mention here is that all my source files when i individually compile compile well but when i compile the entire project that's when i get into trouble.

                1 Reply Last reply
                0
                • hskoglundH Online
                  hskoglundH Online
                  hskoglund
                  wrote on last edited by
                  #8

                  Hmm just a guess, mabe you quuid stuff needs a qglobal.h, perhaps try
                  #include <qglobal.h>
                  just before
                  #include <ui_blackmainwindow.h>
                  in your blackmainwindow.h (or the .h file where the quuid stuff goes)

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

                    Hi hskoglund,

                    I tried including q global but that has not improved the situation.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      apreddy
                      wrote on last edited by
                      #10

                      Hi There,

                      Dose anyone have any more suggestions??

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

                        Have you tried to build the project on other OS (Linux, MacOS X) ?

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          apreddy
                          wrote on last edited by
                          #12

                          I tried building it in Mac OS X and it works fine, and i have not tried bulding it in linux yet.

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

                            Do you use correct compiler to build on windows?
                            Check in the settings what compiler version is selected to Qt 5.

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              apreddy
                              wrote on last edited by
                              #14

                              I a using MinGW4.8 32 bit compile which came along the qt .

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                andreyc
                                wrote on last edited by
                                #15

                                You don't have other versions of Qt and compilers, right?

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  apreddy
                                  wrote on last edited by
                                  #16

                                  nope i uninstalled the previous versons which i had previously installed..

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    andreyc
                                    wrote on last edited by
                                    #17

                                    What if

                                    create a simple Qt project

                                    in the header of MainWindow #include <QUuid>

                                    add QUuid variable to MainWindow

                                    try to compile

                                    Does it generate the error?

                                    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