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. Realloc definition conflict with QObject and C++ vector in Qt project ..

Realloc definition conflict with QObject and C++ vector in Qt project ..

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 430 Views
  • 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.
  • D Offline
    D Offline
    Devesh
    wrote on 15 Nov 2021, 12:27 last edited by
    #1

    Hi.

    I am working on one project where we am using third party library ptlib and opal.
    We have ptlib and opal library working for both linux and windows. Our project is working fine in both Debug and Release build in Ubuntu 20.04 OS and same project is working with Windows Release build.
    But whenever we are trying to build same code is Debug mode in Windows it is giving below,

    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(103): warning C4003: not enough actual parameters for macro 'realloc'
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C2059: syntax error: 'string'
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(327): note: see reference to class template instantiation 'QVector<T>' being compiled
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C3254: 'QVector<T>': class contains explicit override 'Reallocate' but does not derive from an interface that contains the function declaration
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C2838: 'Reallocate': illegal qualified name in member declaration
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(410): warning C4003: not enough actual parameters for macro 'realloc'
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(419): warning C4003: not enough actual parameters for macro 'realloc'
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): warning C4346: 'QVector<T>::PMemoryHeap::Reallocate': dependent name is not a type
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): note: prefix with 'typename' to indicate a type
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): error C2988: unrecognizable template declaration/definition
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): error C2059: syntax error: 'string'
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(766): error C2063: 'Reallocate': not a function
    C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(766): fatal error C1903: unable to recover from previous error(s); stopping compilation

    As we tried to resolve the error, we found that whenever we are adding "#include <QObject>" in only one file name as "Manager.h" it start giving above mentioned error. As we remove "#include <QObject>" header and all other signal and slot(Q_SIGNAL Q_INVOKABLE) from "Manager.h" error goes.
    Note: Whatever error mentioned is only occured while building project in Debug mode in windows.

    QT Creator : 5.0.2 Based on Qt 5.15.2 (MSVC 2019, 64 bit)
    O.S. Windows 10 Home x64

    V 1 Reply Last reply 15 Nov 2021, 13:33
    0
    • D Devesh
      15 Nov 2021, 12:27

      Hi.

      I am working on one project where we am using third party library ptlib and opal.
      We have ptlib and opal library working for both linux and windows. Our project is working fine in both Debug and Release build in Ubuntu 20.04 OS and same project is working with Windows Release build.
      But whenever we are trying to build same code is Debug mode in Windows it is giving below,

      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(103): warning C4003: not enough actual parameters for macro 'realloc'
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C2059: syntax error: 'string'
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(327): note: see reference to class template instantiation 'QVector<T>' being compiled
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C3254: 'QVector<T>': class contains explicit override 'Reallocate' but does not derive from an interface that contains the function declaration
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C2838: 'Reallocate': illegal qualified name in member declaration
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(410): warning C4003: not enough actual parameters for macro 'realloc'
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(419): warning C4003: not enough actual parameters for macro 'realloc'
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): warning C4346: 'QVector<T>::PMemoryHeap::Reallocate': dependent name is not a type
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): note: prefix with 'typename' to indicate a type
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): error C2988: unrecognizable template declaration/definition
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): error C2059: syntax error: 'string'
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(766): error C2063: 'Reallocate': not a function
      C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(766): fatal error C1903: unable to recover from previous error(s); stopping compilation

      As we tried to resolve the error, we found that whenever we are adding "#include <QObject>" in only one file name as "Manager.h" it start giving above mentioned error. As we remove "#include <QObject>" header and all other signal and slot(Q_SIGNAL Q_INVOKABLE) from "Manager.h" error goes.
      Note: Whatever error mentioned is only occured while building project in Debug mode in windows.

      QT Creator : 5.0.2 Based on Qt 5.15.2 (MSVC 2019, 64 bit)
      O.S. Windows 10 Home x64

      V Offline
      V Offline
      VRonin
      wrote on 15 Nov 2021, 13:33 last edited by
      #2

      Nothing to do with Qt: https://titanwolf.org/Network/Articles/Article?AID=d89ed3ee-1cc3-4a32-b28c-a88d2176e11f

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      D 1 Reply Last reply 15 Nov 2021, 15:17
      4
      • V VRonin
        15 Nov 2021, 13:33

        Nothing to do with Qt: https://titanwolf.org/Network/Articles/Article?AID=d89ed3ee-1cc3-4a32-b28c-a88d2176e11f

        D Offline
        D Offline
        Devesh
        wrote on 15 Nov 2021, 15:17 last edited by
        #3

        @VRonin It worked. Thank you very much for the solution.

        1 Reply Last reply
        0

        1/3

        15 Nov 2021, 12:27

        • Login

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