Problem: initializing member array before loop

errors from posted code

Tst:11:8: error: 'array' in namespace 'std' does not name a template type
   std::array <uint8_t, SIZE> member;
        ^~~~~
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino:14:1: warning: extra qualification 'Obj::' on member 'Obj' [-fpermissive]
 Obj::Obj()
 ^~~
Tst:14:1: error: 'Obj::Obj()' cannot be overloaded
Tst:7:3: error: with 'Obj::Obj()'
   Obj();
   ^~~
Tst:19:6: error: 'void Obj::getval(uint8_t)' cannot be overloaded
 void getval(uint8_t pos) {
      ^~~~~~
Tst:8:8: error: with 'void Obj::getval(uint8_t)'
   void getval(uint8_t pos);
        ^~~~~~
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino:26:7: warning: ISO C++ forbids declaration of 'setup' with no type [-fpermissive]
 setup(){
       ^
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino:30:6: warning: ISO C++ forbids declaration of 'loop' with no type [-fpermissive]
 loop() {
      ^
Tst:32:1: error: expected '}' at end of input
 }
 ^
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino: In constructor 'Obj::Obj()':
Tst:16:8: error: 'array' is not a member of 'std'
   std::array <uint8_t, SIZE> member = {0, 1, 2, 3, 4 };
        ^~~~~
Tst:16:22: error: expected primary-expression before ',' token
   std::array <uint8_t, SIZE> member = {0, 1, 2, 3, 4 };
                      ^
Tst:16:30: error: 'member' was not declared in this scope
   std::array <uint8_t, SIZE> member = {0, 1, 2, 3, 4 };
                              ^~~~~~
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino:16:30: note: suggested alternative: 'memmem'
   std::array <uint8_t, SIZE> member = {0, 1, 2, 3, 4 };
                              ^~~~~~
                              memmem
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino: In member function 'void Obj::getval(uint8_t)':
Tst:20:34: error: 'member' was not declared in this scope
   Serial.println("Loop: "+String(member[pos]));
                                  ^~~~~~
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino:20:34: note: suggested alternative: 'memmem'
   Serial.println("Loop: "+String(member[pos]));
                                  ^~~~~~
                                  memmem
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino: In member function 'int Obj::setup()':
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino: In member function 'int Obj::loop()':
Tst:31:3: error: invalid use of member function 'Obj Obj::MyObj()' (did you forget the '()' ?)
   MyObj.getval (0);
   ^~~~~
Tst:31:3: error: invalid use of member function 'Obj Obj::MyObj()' (did you forget the '()' ?)
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino:32:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
C:\stuff\SW\Arduino\_Others\Tst\Tst.ino: At global scope:
Tst:32:1: error: expected unqualified-id at end of input
exit status 1
'array' in namespace 'std' does not name a template type

1 Like