cancel
Showing results for 
Search instead for 
Did you mean: 

Tutorial 3 gives errors. I don't know what I do wrong? Can somebody help me?

0910655
Associate

Detailed log

Converting images

Compiling gui/src/model/Model.cpp

In file included from gui/src/model/Model.cpp:1:0:

gui/include/gui/model/Model.hpp: In constructor 'Model::Model()':

gui/include/gui/model/Model.hpp:65:20: error: 'Model::modelListener' will be initialized after [-Werror=reorder]

   ModelListener* modelListener;

          ^~~~~~~~~~~~~

gui/include/gui/model/Model.hpp:60:10: error:  'int16_t Model::hour' [-Werror=reorder]

 int16_t hour;

     ^~~~

gui/src/model/Model.cpp:8:1: error:  when initialized here [-Werror=reorder]

 Model::Model() : modelListener(0), hour(0)//, minute(0)

 ^~~~~

cc1plus.exe: all warnings being treated as errors

simulator/gcc/Makefile:220: recipe for target 'build/MINGW32_NT-6.2/gui/src/model/Model.o' failed

make[2]: *** [build/MINGW32_NT-6.2/gui/src/model/Model.o] Error 1

simulator/gcc/Makefile:182: recipe for target 'generate_assets' failed

make[1]: *** [generate_assets] Error 2

simulator/gcc/Makefile:40: recipe for target 'all' failed

make: *** [all] Error 2

Model.ccp

#include <gui/model/Model.hpp>

#include <gui/model/ModelListener.hpp>

void Model::tick()

{

}

Model::Model() : modelListener(0), hour(0), minute(0)

{

}

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

Hi @0910655​,

Looks like a simple case of gcc initialization order. Check that you've declared the variables in the same order you're initializing them in (in your Model constructor)

Best regards,

Martin

View solution in original post

3 REPLIES 3
Martin KJELDSEN
Chief III

Hi @0910655​,

Looks like a simple case of gcc initialization order. Check that you've declared the variables in the same order you're initializing them in (in your Model constructor)

Best regards,

Martin

Thank you very much. This is the solution.

No problem! 🙂 Glad it worked out for you.