У меня есть класс AttachTableData, он имеет конструктор с аргументом:
AttachTableData::AttachTableData(Record *iRecord)
Но при компиляции в дебрях Qt почему-то требуется конструктор без аргументов. Я проверил места создания этого объекта. В коде нет места, в котором бы создавался объект без аргументов. Но компилятор всеравно хочет без аргумента.
И проблема в том, что в тексте ошибки не показывается, в каком месте вдруг потребовался конструктор без аргумента.
Текст ошибки (компиляю на вендоноутбуке, до линуксовой машины доберусь в конце недели):
In file included from C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qobject.h:48:0,
from C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qtranslator.h:37,
from C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/QTranslator:1,
from ../mytetra_develop/src/main.cpp:3:
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h: In instantiation of 'static void* QtMetaTypePrivate::QMetaTypeFunctionHelper<T, Accepted>::Create(const void*) [with T = AttachTableData; bool Accepted = true]':
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:1603:76: required from 'int qRegisterNormalizedMetaType(const QByteArray&, T*, typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType) [with T = AttachTableData; typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType = QtPrivate::MetaTypeDefinedHelper<AttachTableData, true>::DefinedType]'
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:1628:77: required from 'int qRegisterMetaType(const char*, T*, typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType) [with T = AttachTableData; typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType = QtPrivate::MetaTypeDefinedHelper<AttachTableData, true>::DefinedType]'
../mytetra_develop/src/models/attachTable/AttachTableData.h:44:1: required from here
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:714:22: error: no matching function for call to 'AttachTableData::AttachTableData()'
return new T();
^
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:714:22: note: candidates are:
In file included from ../mytetra_develop/src/libraries/ClipboardRecords.h:11:0,
from ../mytetra_develop/src/main.cpp:16:
../mytetra_develop/src/models/attachTable/AttachTableData.h:16:3: note: AttachTableData::AttachTableData(const AttachTableData&)
AttachTableData(const AttachTableData &obj);
^
../mytetra_develop/src/models/attachTable/AttachTableData.h:16:3: note: candidate expects 1 argument, 0 provided
../mytetra_develop/src/models/attachTable/AttachTableData.h:15:3: note: AttachTableData::AttachTableData(Record*)
AttachTableData(Record *iRecord);
^
../mytetra_develop/src/models/attachTable/AttachTableData.h:15:3: note: candidate expects 1 argument, 0 provided
In file included from C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qobject.h:48:0,
from C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qtranslator.h:37,
from C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/QTranslator:1,
from ../mytetra_develop/src/main.cpp:3:
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h: In instantiation of 'static void* QtMetaTypePrivate::QMetaTypeFunctionHelper<T, Accepted>::Construct(void*, const void*) [with T = AttachTableData; bool Accepted = true]':
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:1603:76: required from 'int qRegisterNormalizedMetaType(const QByteArray&, T*, typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType) [with T = AttachTableData; typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType = QtPrivate::MetaTypeDefinedHelper<AttachTableData, true>::DefinedType]'
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:1628:77: required from 'int qRegisterMetaType(const char*, T*, typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType) [with T = AttachTableData; typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType = QtPrivate::MetaTypeDefinedHelper<AttachTableData, true>::DefinedType]'
../mytetra_develop/src/models/attachTable/AttachTableData.h:44:1: required from here
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:727:28: error: no matching function for call to 'AttachTableData::AttachTableData()'
return new (where) T;
^
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:727:28: note: candidates are:
In file included from ../mytetra_develop/src/libraries/ClipboardRecords.h:11:0,
from ../mytetra_develop/src/main.cpp:16:
../mytetra_develop/src/models/attachTable/AttachTableData.h:16:3: note: AttachTableData::AttachTableData(const AttachTableData&)
AttachTableData(const AttachTableData &obj);
^
../mytetra_develop/src/models/attachTable/AttachTableData.h:16:3: note: candidate expects 1 argument, 0 provided
../mytetra_develop/src/models/attachTable/AttachTableData.h:15:3: note: AttachTableData::AttachTableData(Record*)
AttachTableData(Record *iRecord);
^
../mytetra_develop/src/models/attachTable/AttachTableData.h:15:3: note: candidate expects 1 argument, 0 provided
In file included from C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qobject.h:48:0,
from C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/QObject:1,
from ../mytetra_develop/src/views/recordTable/RecordTableView.cpp:1:
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h: In instantiation of 'static void* QtMetaTypePrivate::QMetaTypeFunctionHelper<T, Accepted>::Create(const void*) [with T = AttachTableData; bool Accepted = true]':
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:1603:76: required from 'int qRegisterNormalizedMetaType(const QByteArray&, T*, typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType) [with T = AttachTableData; typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType = QtPrivate::MetaTypeDefinedHelper<AttachTableData, true>::DefinedType]'
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:1628:77: required from 'int qRegisterMetaType(const char*, T*, typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType) [with T = AttachTableData; typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType = QtPrivate::MetaTypeDefinedHelper<AttachTableData, true>::DefinedType]'
../mytetra_develop/src/models/attachTable/AttachTableData.h:44:1: required from here
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:714:22: error: no matching function for call to 'AttachTableData::AttachTableData()'
return new T();
^
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:714:22: note: candidates are:
In file included from ../mytetra_develop/src/libraries/ClipboardRecords.h:11:0,
from ../mytetra_develop/src/views/recordTable/RecordTableView.cpp:10:
../mytetra_develop/src/models/attachTable/AttachTableData.h:16:3: note: AttachTableData::AttachTableData(const AttachTableData&)
AttachTableData(const AttachTableData &obj);
^
../mytetra_develop/src/models/attachTable/AttachTableData.h:16:3: note: candidate expects 1 argument, 0 provided
../mytetra_develop/src/models/attachTable/AttachTableData.h:15:3: note: AttachTableData::AttachTableData(Record*)
AttachTableData(Record *iRecord);
^
../mytetra_develop/src/models/attachTable/AttachTableData.h:15:3: note: candidate expects 1 argument, 0 provided
In file included from C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qobject.h:48:0,
from C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/QObject:1,
from ../mytetra_develop/src/views/recordTable/RecordTableView.cpp:1:
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h: In instantiation of 'static void* QtMetaTypePrivate::QMetaTypeFunctionHelper<T, Accepted>::Construct(void*, const void*) [with T = AttachTableData; bool Accepted = true]':
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:1603:76: required from 'int qRegisterNormalizedMetaType(const QByteArray&, T*, typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType) [with T = AttachTableData; typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType = QtPrivate::MetaTypeDefinedHelper<AttachTableData, true>::DefinedType]'
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:1628:77: required from 'int qRegisterMetaType(const char*, T*, typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType) [with T = AttachTableData; typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2<T>::Defined && (! QMetaTypeId2<T>::IsBuiltIn))>::DefinedType = QtPrivate::MetaTypeDefinedHelper<AttachTableData, true>::DefinedType]'
../mytetra_develop/src/models/attachTable/AttachTableData.h:44:1: required from here
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:727:28: error: no matching function for call to 'AttachTableData::AttachTableData()'
return new (where) T;
^
C:/tools/qt/qt5.4.2/5.4/mingw491_32/include/QtCore/qmetatype.h:727:28: note: candidates are:
In file included from ../mytetra_develop/src/libraries/ClipboardRecords.h:11:0,
from ../mytetra_develop/src/views/recordTable/RecordTableView.cpp:10:
../mytetra_develop/src/models/attachTable/AttachTableData.h:16:3: note: AttachTableData::AttachTableData(const AttachTableData&)
AttachTableData(const AttachTableData &obj);
^
../mytetra_develop/src/models/attachTable/AttachTableData.h:16:3: note: candidate expects 1 argument, 0 provided
../mytetra_develop/src/models/attachTable/AttachTableData.h:15:3: note: AttachTableData::AttachTableData(Record*)
AttachTableData(Record *iRecord);
^
../mytetra_develop/src/models/attachTable/AttachTableData.h:15:3: note: candidate expects 1 argument, 0 provided
Makefile.Debug:9137: recipe for target 'build/main.o' failed
mingw32-make[1]: *** [build/main.o] Error 1
Ссылка на исходники проекта:
https://github.com/xintrea/mytetra_dev/commit/9b93eec7bcff6addc71f82e452a0ff7...