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. Fresh binary install of QT5.2.1 for MSVC2010 - qmap.h error
Forum Updated to NodeBB v4.3 + New Features

Fresh binary install of QT5.2.1 for MSVC2010 - qmap.h error

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.6k 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.
  • P Offline
    P Offline
    parkerj33
    wrote on last edited by
    #1

    My app builds fine with QT5.1.1 using msvc2010 (32bit). Installed the binary build of QT5.2.1 for MSVC10 32bit.

    Get this error:

    C:\Qt\5.2.1\msvc2010\include\QtCore/qmap.h(216) : error C2059: syntax error : '&'
    C:\Qt\5.2.1\msvc2010\include\QtCore/qmap.h(212) : while compiling class template member function 'QMapNode<Key,T> *QMapData<Key,T>::createNode(const Key &,const T &,QMapNode<Key,T> *,bool)'
    with
    [
    Key=QString,
    T=QVariant
    ]
    C:\Qt\5.2.1\msvc2010\include\QtCore/qmap.h(333) : see reference to class template instantiation 'QMapData<Key,T>' being compiled
    with
    [
    Key=QString,
    T=QVariant
    ]
    C:\Qt\5.2.1\msvc2010\include\QtCore/qmap.h(333) : while compiling class template member function 'QMap<Key,T>::QMap(void)'
    with
    [
    Key=QString,
    T=QVariant
    ]
    C:\Qt\5.2.1\msvc2010\include\QtCore/qvariant.h(501) : see reference to class template instantiation 'QMap<Key,T>' being compiled
    with
    [
    Key=QString,
    T=QVariant
    ]
    C:\Qt\5.2.1\msvc2010\include\QtCore/qmap.h(216) : error C2143: syntax error : missing ';' before ')'
    C:\Qt\5.2.1\msvc2010\include\QtCore/qmap.h(216) : error C2143: syntax error : missing ';' before ')'
    C:\Qt\5.2.1\msvc2010\include\QtCore/qmap.h(218) : error C2059: syntax error : '&'
    C:\Qt\5.2.1\msvc2010\include\QtCore/qmap.h(218) : error C2143: syntax error : missing ';' before ')'
    C:\Qt\5.2.1\msvc2010\include\QtCore/qmap.h(218) : error C2143: syntax error : missing ';' before ')'

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mastermemorex
      wrote on last edited by
      #2

      It took me some hairs of my head, but I found the problem.
      Some library headers in debug mode redefine the 'new' operator in order to catch memory leaks; something like this:

      @#define new new( _NORMAL_BLOCK, FILE, LINE)@

      The problem is with this lines in qmap.h, where they use the new operator in a very unusual way.

      @
      QT_TRY{
      new (&n->key) Key(k); /* !!! /
      QT_TRY{
      new (&n->value) T(v); /
      !!! */
      @

      The workaround is to undef the new operator before the qt headers.
      @
      #undef new
      #include "qt_header.h"
      @

      I don't know if it can be considered a bug, but certainly it is source of troubles.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        No it's not, generally on Windows you would include Windows specific headers after Qt's

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        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