Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. getting warning in Qt creator c++
Forum Updated to NodeBB v4.3 + New Features

getting warning in Qt creator c++

Scheduled Pinned Locked Moved Unsolved C++ Gurus
2 Posts 2 Posters 741 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.
  • S Offline
    S Offline
    shashi prasad
    wrote on 9 Aug 2017, 11:44 last edited by
    #1

    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

    K 1 Reply Last reply 9 Aug 2017, 11:59
    0
    • S shashi prasad
      9 Aug 2017, 11:44

      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

      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 9 Aug 2017, 11:59 last edited by
      #2

      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;
      }
      

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      1

      1/2

      9 Aug 2017, 11:44

      • Login

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