getting warning in Qt creator c++
Unsolved
C++ Gurus
-
Hi
i have written code in c++ using qt creator IDE.
i have decleared variable asTiXmlDocument *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
-
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 { 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; }