[Interest] Failed to compile moc file...
Igor Mironchik
igor.mironchik at gmail.com
Wed Jun 17 21:59:23 CEST 2015
Hi guys,
I use following technique always. But only now I've received the
following error.
Look:
// Qt include.
#include <QWidget>
#include <QScopedPointer>
// Como include.
#include <Como/Source>
QT_BEGIN_NAMESPACE
class QModelIndex;
QT_END_NAMESPACE
namespace Globe {
class Channel;
//
// SourcesWidget
//
class SourcesWidgetPrivate;
//! Widget that will display available sources.
class SourcesWidget
: public QWidget
{
Q_OBJECT
signals:
//! Source was selected.
void sourceSelected( const Como::Source & );
//! Channel was selected.
void channelSelected( const QString & );
public:
SourcesWidget( QWidget * parent = 0, Qt::WindowFlags f = 0 );
//! \return Name of the current channel.
QString channelName() const;
//! Set channel name.
void setChannelName( const QString & channelName );
private:
//! Init.
void init();
private slots:
//! New source.
void newSource( const Como::Source & source, const QString &
channelName );
//! Channel created.
void channelCreated( Channel * channel );
//! Channel removed.
void channelRemoved( Channel * channel );
//! Channel selected.
void selectChannel( const QString & channelName );
//! Item activated.
void itemActivated( const QModelIndex & index );
private:
Q_DISABLE_COPY( SourcesWidget )
QScopedPointer< SourcesWidgetPrivate > d;
}; // class SourcesWidget
} /* namespace Globe */
This header uses forward declaration of data class SourcesWidgetPrivate.
It defined in cpp file.
All my moc compiles successfully, but moc generated from this header
fails with:
Konsole output
g++ -c -pipe -O2 -fPIC -D_REENTRANT -Wall -W -DQT_NO_DEBUG
-DQT_WIDGETS_LIB -DQT
_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_CORE_LIB
-I. -I.
./../Globe -I../../../globe-como -I../../QtConfFile -I../../Como
-I/home/igor/Qt
/5.4/gcc_64/include -I/home/igor/Qt/5.4/gcc_64/include/QtWidgets
-I/home/igor/Qt
/5.4/gcc_64/include/QtMultimedia
-I/home/igor/Qt/5.4/gcc_64/include/QtGui -I/hom
e/igor/Qt/5.4/gcc_64/include/QtNetwork
-I/home/igor/Qt/5.4/gcc_64/include/QtSql
-I/home/igor/Qt/5.4/gcc_64/include/QtCore -I. -I.
-I/home/igor/Qt/5.4/gcc_64/mks
pecs/linux-g++ -o moc_sources_widget.o moc_sources_widget.cpp
In file included from
/home/igor/Qt/5.4/gcc_64/include/QtCore/qobject.h:47:0,
from
/home/igor/Qt/5.4/gcc_64/include/QtWidgets/qwidget.h:38,
from /home/igor/Qt/5.4/gcc_64/include/QtWidgets/QWidget:1,
from sources_widget.hpp:35,
from moc_sources_widget.cpp:9:
/home/igor/Qt/5.4/gcc_64/include/QtCore/qscopedpointer.h: In
instantiation of ‘s
tatic void QScopedPointerDeleter<T>::cleanup(T*) [with T =
Globe::SourcesWidgetP
rivate]’:
/home/igor/Qt/5.4/gcc_64/include/QtCore/qscopedpointer.h:101:30:
required from
‘QScopedPointer<T, Cleanup>::~QScopedPointer() [with T =
Globe::SourcesWidgetPr
ivate; Cleanup = QScopedPointerDeleter<Globe::SourcesWidgetPrivate>]’
sources_widget.hpp:58:7: required from here
/home/igor/Qt/5.4/gcc_64/include/QtCore/qscopedpointer.h:51:46: error:
invalid a
pplication of ‘sizeof’ to incomplete type ‘Globe::SourcesWidgetPrivate’
typedef char IsIncompleteType[ sizeof(T) ? 1 : -1 ];
^
/home/igor/Qt/5.4/gcc_64/include/QtCore/qscopedpointer.h:54:9: warning:
possible
problem detected in invocation of delete operator: [-Wdelete-incomplete]
delete pointer;
^
/home/igor/Qt/5.4/gcc_64/include/QtCore/qscopedpointer.h:46:35: warning:
‘pointe
r’ has incomplete type
static inline void cleanup(T *pointer)
^
In file included from moc_sources_widget.cpp:9:0:
sources_widget.hpp:55:7: warning: forward declaration of ‘class
Globe::SourcesWi
dgetPrivate’
class SourcesWidgetPrivate;
^
In file included from
/home/igor/Qt/5.4/gcc_64/include/QtCore/qobject.h:47:0,
from
/home/igor/Qt/5.4/gcc_64/include/QtWidgets/qwidget.h:38,
from /home/igor/Qt/5.4/gcc_64/include/QtWidgets/QWidget:1,
from sources_widget.hpp:35,
from moc_sources_widget.cpp:9:
/home/igor/Qt/5.4/gcc_64/include/QtCore/qscopedpointer.h:54:9: note:
neither the
destructor nor the class-specific operator delete will be called, even
if they
are declared when the class is defined
delete pointer;
^
Makefile:17300: recipe for target 'moc_sources_widget.o' failed
What wrong? I can't understand...
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150617/4735e806/attachment.html>
More information about the Interest
mailing list