gcc warning" 'will be initialized after'

Make sure the members appear in the initializer list in the same order as they appear in the class

Class C {
   int a;
   int b;
   C():b(1),a(2){} //warning, should be C():a(2),b(1)
}

or you can turn -Wno-reorder


You can disable it with -Wno-reorder.


For those using QT having this error, add this to .pro file

QMAKE_CXXFLAGS_WARN_ON += -Wno-reorder

use -Wno-reorder (man gcc is your friend :) )


If you're seeing errors from library headers and you're using GCC, then you can disable warnings by including the headers using -isystem instead of -I.

Similar features exist in clang.

If you're using CMake, you can specify SYSTEM for include_directories.