getting warning in Qt creator c++

  • Hi
    i have written code in c++ using qt creator IDE.
    i have decleared variable as

    TiXmlDocument *m_p_Doc;
    TiXmlElement *pElem, *pElem1;
    TiXmlHandle hRoot, hRootQuery;

    code compile correctly and working fine.
    but giving warning as
    warning: 'TiXmlElement* P2Response::pElem' [-Wreorder]
    TiXmlElement* pElem, *pElem1;

    so please suggest me

  • Qt Champions 2017

    The compiler is just warning you that order of initialization will be different than what you requested.
    You need to initialize the variables in the constructor's initializer in the order they're declared in the class. E.g:

    class X
            : a(0), b(0)  //< In the same order they're declared in the class, if you use b(0), a(0) it will generate the warning.
        int a;
        int b;

Log in to reply

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