[solved] errors from qt files when porting from 4.8 to 5.1

  • I'm trying to port a program from version 4.8 to 5.1, and after most error and issues are gone. I get stuck with a few that is from header files inside the qt5.1 library. It is the following 2 errors:

    C:\Qt\Qt5.1.1\5.1.1\mingw48_32\include\QtCore\qglobal.h:890: error: 'd_ptr' was not declared in this scope
    inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); } \

    C:\Qt\Qt5.1.1\5.1.1\mingw48_32\include\QtCore\qglobal.h:607: error: invalid operands of types 'const char*' and 'const char*' to binary 'operator<<'

    define qPrintable(string) QString(string).toLocal8Bit().constData()

  • here is another error I get:

    c:\qt\qt5.1.1\tools\mingw48_32\i686-w64-mingw32\include\rpcndr.h:110: error: previous declaration 'void* MIDL_user_allocate(SIZE_T)' here
    void *__RPC_USER MIDL_user_allocate(SIZE_T);

    I find it strange that these errors occur and can not find the reason.

  • Moderators

    It is hard to guess what the causes are if you are not providing some code snippets and indication of lines associated with the errors.

  • the error is in qglobal.h;
    (line 607)
    #ifndef qPrintable

    define qPrintable(string) QString(string).toLocal8Bit().constData()


    #define Q_DECLARE_PRIVATE(Class)
    inline Class##Private* d_func() { return reinterpret_cast<Class##Private >(qGetPtrHelper(d_ptr)); }
    inline const Class##Private
    d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); }
    friend class Class##Private;

    And there are no errors in my code at this moment that I can se trigger this..

Log in to reply

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