Qt 4.7.4 qmetatype errors in Linux



  • Hello, dear Qt developers! I got a problem and I can't understand why it appears. I downloaded Qt 4.7.4 sources, build it in Linux (Mint16 if it matters).
    I used Qt in VS before, so I generate .pro files using Qt add-in and copied whole project to Linux. Fixed some path issues etc, and now when I try to compile my project there one of the errors I get is the

    • /opt/Qt4.7.4/include/QtCore/qmetatype.h:271: error: definition of 'static int QMetaTypeId<QMap<int, double>>::qt_metatype_id()' is not in namespace enclosing 'QMetaTypeId<QMap<int, double>>' [-fpermissive]

    !http://gyazo.com/0343f42924c72d5a350e586f52656540.png(error output)!

    When I run my project in Windows there are no such error!

    Whats worng? How to fix that problem if its possible?



  • bq. When I run my project in Windows there are no such error!

    Nothing to do with running your application. You are not getting past compilation.

    bq. Whats worng? How to fix that problem if its possible?

    We cannot see your code so we cannot know exactly what you are doing to trigger this. At a guess you are declaring a QMetaTypeId specialisation in a namespace by incorrectly using Q_DECLARE_METATYPE. GCC is not compiling the resulting source where MSVC has been more lax.

    You should read the docs about Q_DECLARE_METATYPE and namespaces:
    http://qt-project.org/doc/qt-4.8/qmetatype.html#Q_DECLARE_METATYPE

    Is there a reason you are using an old version of Qt?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.