Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[Plugin-Dev] invalid use of "::" when using non-Qt-namespace with QDebug



  • Hi,

    I'm writing a Qt-Plugin access MongoDB from QML.
    But anytime I add @#include <QDebug>@ to my source file or header file, the compilation of my QObject-derived-class that uses types in the mongo namespace failes with the error
    @/usr/include/qt4/QtCore/qvector.h:83: Error:invalid use of ‘::’@
    It does not matter if I write @use namespace mongo@ or not (If I don't write that, I must put "mongo::" everywhere any the resulting error message states @Error:invalid use of ‘mongo::’@)
    But if I don't include QDebug, everything works fine!

    The head of my .pro file looks like this:
    @TEMPLATE = lib
    CONFIG += qt plugin
    QT += core declarative
    @

    Can anybody tell me what I'm doing wrong here?

    Edit: moved to General as it doesn't seem to be a QML/Quick specific issue; Andre



  • Hi manuelsch,

    can you please check, whether it also appears if you include qvector directly and not QDebug? That would state whether the problem is with qdebug or qvector.

    If I look at QVector line 83, I see:

    @
    static QVectorData *malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init);
    @

    But that might be different on your machine, as I might use different version / license.
    Please have a look what is located in QVector.h line 83 and post it here



  • Thanks, Gerolf!

    Yes, I also have this line at this position in the file.
    But I figured out how to solve it.

    Don't ask my why, but it's simple: just put @#include <QDebug>@ at the very top of the .cpp file.
    If it is the first file that is included, it works!



  • what did you includa before on top (or before QDebug)?
    It must have some influence on that lines...


Log in to reply