Results 1 to 3 of 3

Thread: Compiling error

  1. #1
    Join Date
    Jan 2006
    Location
    Innsbruck, Austria
    Posts
    62
    Thanks
    10
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Unhappy Compiling error

    I'm getting this compiling error but I can't find the problem. Any ideas?

    g++ -c -pipe -g -pg -Wall -W -D_REENTRANT -DALLOW_LOCALFILESYSTEM -DKDE_INTEGRATION -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/lib/qt4/mkspecs/linux-g++ -I. -I/usr/lib/qt4/include/QtCore -I/usr/lib/qt4/include/QtCore -I/usr/lib/qt4/include/QtGui -I/usr/lib/qt4/include/QtGui -I/usr/lib/qt4/include -I. -I. -o errorlog.o errorlog.cpp
    /usr/lib/qt4/include/QtCore/qobject.h: In copy constructor 'GenericError::GenericError(const GenericError&)':
    genericerror.h:5: instantiated from 'void QList<T>::append(const T&) [with T = GenericError]'
    errorlog.cpp:15: instantiated from here
    /usr/lib/qt4/include/QtCore/qobject.h:277: error: 'QObject::QObject(const QObject&)' is private
    genericerror.h:5: error: within this context
    /usr/lib/qt4/include/QtCore/qlist.h: In member function 'void QList<T>::append(const T&) [with T = GenericError]':
    /usr/lib/qt4/include/QtCore/qlist.h:403: note: synthesized method 'GenericError::GenericError(const GenericError&)' first required here
    /usr/lib/qt4/include/QtCore/qlist.h: In member function 'int QList<T>::removeAll(const T&) [with T = GenericError]':
    errorlog.cpp:22: instantiated from here
    /usr/lib/qt4/include/QtCore/qlist.h:558: error: no match for 'operator==' in '(n <unknown operator> ((QList<GenericError>::Node*)((QList<GenericError> *)this)->QList<GenericError>::<anonymous>.QList<GenericErr or>::<anonymous union>::p. QListData::at(i)))->QList<T>::Node::t [with T = GenericError]() == t'
    /usr/lib/qt4/include/QtCore/qglobal.h:1375: note: candidates are: bool operator==(QBool, bool)
    /usr/lib/qt4/include/QtCore/qglobal.h:1376: note: bool operator==(bool, QBool)
    /usr/lib/qt4/include/QtCore/qglobal.h:1377: note: bool operator==(QBool, QBool)
    /usr/lib/qt4/include/QtCore/qchar.h:285: note: bool operator==(QChar, QChar)
    /usr/lib/qt4/include/QtCore/qbytearray.h:433: note: bool operator==(const QByteArray&, const QByteArray&)
    /usr/lib/qt4/include/QtCore/qbytearray.h:435: note: bool operator==(const QByteArray&, const char*)
    /usr/lib/qt4/include/QtCore/qbytearray.h:437: note: bool operator==(const char*, const QByteArray&)
    /usr/lib/qt4/include/QtCore/qstring.h:755: note: bool operator==(QString::Null, QString::Null)
    /usr/lib/qt4/include/QtCore/qstring.h:756: note: bool operator==(QString::Null, const QString&)
    /usr/lib/qt4/include/QtCore/qstring.h:757: note: bool operator==(const QString&, QString::Null)
    /usr/lib/qt4/include/QtCore/qstring.h:784: note: bool operator==(const char*, const QString&)
    /usr/lib/qt4/include/QtCore/qhash.h:148: note: bool operator==(const QHashDummyValue&, const QHashDummyValue&)
    /usr/lib/qt4/include/QtCore/qobject.h: In member function 'GenericError& GenericError::operator=(const GenericError&)':
    genericerror.h:5: instantiated from 'void QList<T>::node_construct(QList<T>::Node*, const T&) [with T = GenericError]'
    /usr/lib/qt4/include/QtCore/qlist.h:401: instantiated from 'void QList<T>::append(const T&) [with T = GenericError]'
    errorlog.cpp:15: instantiated from here
    /usr/lib/qt4/include/QtCore/qobject.h:277: error: 'QObject& QObject::operator=(const QObject&)' is private
    genericerror.h:5: error: within this context
    /usr/lib/qt4/include/QtCore/qlist.h: In member function 'void QList<T>::node_construct(QList<T>::Node*, const T&) [with T = GenericError]':
    /usr/lib/qt4/include/QtCore/qlist.h:316: note: synthesized method 'GenericError& GenericError::operator=(const GenericError&)' first required here
    make: *** [errorlog.o] Error 1
    errorlog.h
    Qt Code:
    1. #include <QList>
    2. #include "genericerror.h"
    3.  
    4. class ErrorLog : public QObject
    5. {
    6. Q_OBJECT
    7.  
    8. public:
    9. ErrorLog(QObject *parent = 0);
    10.  
    11. QList<GenericError> errorList();
    12. void registerError(const GenericError& error);
    13. void removeError(const GenericError& error);
    14. void clear();
    15.  
    16. signals:
    17. void errorHappened(const GenericError& error);
    18. void errorFixed(const GenericError& error);
    19.  
    20. private:
    21. QList<GenericError> m_errorList;
    22. };
    To copy to clipboard, switch view to plain text mode 

    errorlog.cpp
    Qt Code:
    1. ErrorLog::ErrorLog(QObject *parent)
    2. : QObject(parent)
    3. {
    4. }
    5.  
    6.  
    7. QList<GenericError> ErrorLog::errorList()
    8. {
    9. return m_errorList;
    10. }
    11.  
    12.  
    13. void ErrorLog::registerError(const GenericError& error)
    14. {
    15. m_errorList.append(error);
    16. emit errorHappened(error);
    17. }
    18.  
    19.  
    20. void ErrorLog::removeError(const GenericError& error)
    21. {
    22. m_errorList.removeAll(error);
    23. emit errorFixed(error);
    24. }
    25.  
    26.  
    27. void ErrorLog::clear()
    28. {
    29. m_errorList.clear();
    30. }
    To copy to clipboard, switch view to plain text mode 

    genericerror.h
    Qt Code:
    1. #include <QObject>
    2. #include <QString>
    3. #include "apachecontext.h"
    4.  
    5. class GenericError : public QObject
    6. {
    7. Q_OBJECT
    8.  
    9. public:
    10. enum Severity { NoError, Info, Warning, Error, Critical };
    11.  
    12. GenericError(QObject *parent = 0);
    13.  
    14. virtual GenericError::Severity severity() const;
    15. virtual void setSeverity(Severity severity);
    16. virtual QString title() const;
    17. virtual void setTitle(const QString& title);
    18. virtual QString description() const;
    19. virtual void setDescription(const QString& description);
    20. virtual VirtualHostId virtualHost() const;
    21. virtual void setVirtualHost(VirtualHostId vHost);
    22. virtual QString filePath() const;
    23. virtual void setFilePath(const QString& filePath);
    24. virtual int lineNumber() const;
    25. virtual void setLineNumber(int lineNo);
    26. virtual bool canAutoFix() const;
    27. virtual bool canWorkIt() const;
    28. virtual bool canComment() const;
    29. virtual bool canRemove() const;
    30. virtual bool autoFix();
    31. virtual bool workIt();
    32. virtual bool comment();
    33. virtual bool remove();
    34.  
    35. protected:
    36. Severity m_severity;
    37. QString m_title;
    38. QString m_description;
    39. VirtualHostId m_vHost;
    40. QString m_filePath;
    41. int m_lineNumber;
    42. };
    To copy to clipboard, switch view to plain text mode 
    Last edited by jacek; 9th March 2007 at 22:48. Reason: changed [code] to [quote]

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Compiling error

    You can't copy a QObject - and this is what you implicit do when you define a QList<QObject>.
    You can use a QList<QObject*> or not derive from QObject.

  3. The following user says thank you to ChristianEhrlicher for this useful post:

    vfernandez (9th March 2007)

  4. #3
    Join Date
    Jan 2006
    Location
    Innsbruck, Austria
    Posts
    62
    Thanks
    10
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Compiling error

    Ok, I've made it not being a QObject and implemented the operator==() and now it works. Thanks.

Similar Threads

  1. Installation on Fedora Core 4
    By jcr in forum Installation and Deployment
    Replies: 3
    Last Post: 29th January 2009, 02:34
  2. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 05:19
  3. Qt-x11-commercial-src-4.2.0-snapshot-20060824 error
    By DevObject in forum Installation and Deployment
    Replies: 4
    Last Post: 25th August 2006, 00:31
  4. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 13:52
  5. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 13:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.