Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Plugin-Dev] invalid use of "::" when using non-Qt-namespace with QDebug
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    manuelsch
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      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

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        manuelsch
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

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

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved