Qt template specialization error and linking issues
-
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
-
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_OBJECTpublic:
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(QString filePath); void setBlackTrackOnPlayer(); void setBlackTrackOnAnalysisWidget(); void setShotTrackOnPlayer(); void setShotTrackOnAnalysisWidget(); void detectBlackFrames(); void detectBlackFramesFinished(); void detectShots(); void detectShotsFinished(); void generateXMLReport(); QString getBaseNameOfDpxFile(QString file);
};
#endif @
I hope this helps
-
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; }
}@
-
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.0I guess you will need to comment out the suspicious lines one by one and try to find what particular line cause this error.
-
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.