Error with ISO C++ forbids initialization of member

Hi,

I'm trying to include the codrone.h file and I keep getting the following range of errors:
(library file) CoDrone/CoDrone.h:1013: error: ISO C++ forbids in-class initialization of non-const static member 'receiveAttitudeSuccess'
(library file) CoDrone/CoDrone.h:1014: error: ISO C++ forbids initialization of member 'receiveRangeSuccess'
(library file) CoDrone/CoDrone.h:1014: error: making 'receiveRangeSuccess' static

They seems to occur whenever byte is used as a datatype. I added the line:

typedef uint8_t byte;

Thinking that it was a datatype issue, but it didn't help any. Anyone have any thoughts?

CoDrone.h

Do you think that it would be helpful to see your code and to have a link to where the library can be downloaded ?

I added a hyperlink. It's the CoDrone.h file. I can include the full link outside of a hyperlink if that's easier.

This is the original code without the typedef I tried adding.

If the typedef is the cause, I think it will be useful if you post YOUR code as well.

I listed the line of code i tried in my original post. The typedef isn't the cause. I took it out. It was just something I tried to fix the original error. It changed nothing.

I've downloaded the library and examples and compiled B10_Analog_Read_and_Controller_Fight.ino for a Leonardo without any problems. I've used IDE 1.8.13, avr-gcc version 7.3.0.

There are a number of warnings.

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp: In member function 'void CoDroneClass::ConnectionProcess(byte, byte*)':

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:108:17: warning: unused variable 'tryconnect' [-Wunused-variable]

   unsigned long tryconnect = millis();

                 ^~~~~~~~~~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:98:16: warning: unused variable 'currentTimes' [-Wunused-variable]

  unsigned long currentTimes;

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

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp: In member function 'void CoDroneClass::ReceiveEventCheck(byte*)':

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:332:8: warning: unused variable 'devName' [-Wunused-variable]

   byte devName[20];

        ^~~~~~~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:379:9: warning: unused variable 'irMassageDirection' [-Wunused-variable]

    byte irMassageDirection = _completeData[0];

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

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:404:7: warning: unused variable 'GyroBias_Roll' [-Wunused-variable]

   int GyroBias_Roll  = ((_completeData[1] << 8) | (_completeData[0]  & 0xff));

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

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:405:7: warning: unused variable 'GyroBias_Pitch' [-Wunused-variable]

   int GyroBias_Pitch = ((_completeData[3] << 8) | (_completeData[2]  & 0xff));

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

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:406:7: warning: unused variable 'GyroBias_Yaw' [-Wunused-variable]

   int GyroBias_Yaw  = ((_completeData[5] << 8) | (_completeData[4]  & 0xff));

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

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:459:37: warning: left shift count >= width of type [-Wshift-count-overflow]

   long d1   = ((_completeData[3] << 32)  |(_completeData[2] << 16)  |(_completeData[1] << 8)  | (_completeData[0]  & 0xff));

                                     ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:459:64: warning: left shift count >= width of type [-Wshift-count-overflow]

   long d1   = ((_completeData[3] << 32)  |(_completeData[2] << 16)  |(_completeData[1] << 8)  | (_completeData[0]  & 0xff));

                                                                ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:460:37: warning: left shift count >= width of type [-Wshift-count-overflow]

   long d2   = ((_completeData[7] << 32)  |(_completeData[6] << 16)  |(_completeData[5] << 8)  | (_completeData[4]  & 0xff));

                                     ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:460:64: warning: left shift count >= width of type [-Wshift-count-overflow]

   long d2   = ((_completeData[7] << 32)  |(_completeData[6] << 16)  |(_completeData[5] << 8)  | (_completeData[4]  & 0xff));

                                                                ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:461:40: warning: left shift count >= width of type [-Wshift-count-overflow]

   temperature = ((_completeData[11] << 32) |(_completeData[10] << 16) |(_completeData[9] << 8)  | (_completeData[8]  & 0xff));

                                        ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:461:67: warning: left shift count >= width of type [-Wshift-count-overflow]

   temperature = ((_completeData[11] << 32) |(_completeData[10] << 16) |(_completeData[9] << 8)  | (_completeData[8]  & 0xff));

                                                                   ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:462:38: warning: left shift count >= width of type [-Wshift-count-overflow]

   pressure  = ((_completeData[15] << 32) |(_completeData[14] << 16) |(_completeData[13] << 8) | (_completeData[12]  & 0xff));

                                      ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:462:65: warning: left shift count >= width of type [-Wshift-count-overflow]

   pressure  = ((_completeData[15] << 32) |(_completeData[14] << 16) |(_completeData[13] << 8) | (_completeData[12]  & 0xff));

                                                                 ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:459:8: warning: unused variable 'd1' [-Wunused-variable]

   long d1   = ((_completeData[3] << 32)  |(_completeData[2] << 16)  |(_completeData[1] << 8)  | (_completeData[0]  & 0xff));

        ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:460:8: warning: unused variable 'd2' [-Wunused-variable]

   long d2   = ((_completeData[7] << 32)  |(_completeData[6] << 16)  |(_completeData[5] << 8)  | (_completeData[4]  & 0xff));

        ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:470:41: warning: left shift count >= width of type [-Wshift-count-overflow]

   fVelocitySumX = ((_completeData[3] << 32)  |(_completeData[2] << 16)  |(_completeData[1] << 8)  | (_completeData[0]  & 0xff));

                                         ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:470:68: warning: left shift count >= width of type [-Wshift-count-overflow]

   fVelocitySumX = ((_completeData[3] << 32)  |(_completeData[2] << 16)  |(_completeData[1] << 8)  | (_completeData[0]  & 0xff));

                                                                    ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:471:41: warning: left shift count >= width of type [-Wshift-count-overflow]

   fVelocitySumY = ((_completeData[7] << 32)  |(_completeData[6] << 16)  |(_completeData[5] << 8)  | (_completeData[4]  & 0xff));

                                         ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:471:68: warning: left shift count >= width of type [-Wshift-count-overflow]

   fVelocitySumY = ((_completeData[7] << 32)  |(_completeData[6] << 16)  |(_completeData[5] << 8)  | (_completeData[4]  & 0xff));

                                                                    ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:488:53: warning: left shift count >= width of type [-Wshift-count-overflow]

   int batteryRaw           = ((_completeData[12] << 32) |(_completeData[11] << 16) |(_completeData[10] << 8) | (_completeData[9]  & 0xff));

                                                     ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:488:80: warning: left shift count >= width of type [-Wshift-count-overflow]

   int batteryRaw           = ((_completeData[12] << 32) |(_completeData[11] << 16) |(_completeData[10] << 8) | (_completeData[9]  & 0xff));

                                                                                ^~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:483:7: warning: unused variable 'batteryV30' [-Wunused-variable]

   int batteryV30           = ((_completeData[1] << 8) | (_completeData[0] & 0xff));

       ^~~~~~~~~~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:484:7: warning: unused variable 'batteryV33' [-Wunused-variable]

   int batteryV33           = ((_completeData[3] << 8) | (_completeData[2] & 0xff));

       ^~~~~~~~~~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:485:7: warning: unused variable 'batteryGradient' [-Wunused-variable]

   int batteryGradient        = ((_completeData[5] << 8) | (_completeData[4] & 0xff));

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

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:486:7: warning: unused variable 'batteryyIntercept' [-Wunused-variable]

   int batteryyIntercept       = ((_completeData[7] << 8) | (_completeData[6] & 0xff));

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

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:487:7: warning: unused variable 'flagBatteryCalibration' [-Wunused-variable]

   int flagBatteryCalibration     = _completeData[8];

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

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone.cpp:488:7: warning: unused variable 'batteryRaw' [-Wunused-variable]

   int batteryRaw           = ((_completeData[12] << 32) |(_completeData[11] << 16) |(_completeData[10] << 8) | (_completeData[9]  & 0xff));

       ^~~~~~~~~~

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone_request.cpp: In member function 'void CoDroneClass::ReceiveGetData(byte)':

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone_request.cpp:33:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

   if (oldTime + 500 < millis()) break; //time out check

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

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone_send.cpp: In member function 'void CoDroneClass::BattleReceive()':

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone_send.cpp:1005:23: warning: suggest parentheses around '&&' within '||' [-Wparentheses]

   if(team == TEAM_RED && irMessageReceive == BLUE_MISSILE || irMessageReceive == GREEN_MISSILE || irMessageReceive == YELLOW_MISSILE || irMessageReceive == FREE_MISSILE) BattleDamageProcess();

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone_send.cpp:1006:29: warning: suggest parentheses around '&&' within '||' [-Wparentheses]

   else if(team == TEAM_BLUE && irMessageReceive == RED_MISSILE || irMessageReceive == GREEN_MISSILE || irMessageReceive == YELLOW_MISSILE || irMessageReceive == FREE_MISSILE) BattleDamageProcess();

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone_send.cpp:1007:30: warning: suggest parentheses around '&&' within '||' [-Wparentheses]

   else if(team == TEAM_GREEN && irMessageReceive == BLUE_MISSILE || irMessageReceive == RED_MISSILE || irMessageReceive == YELLOW_MISSILE || irMessageReceive == FREE_MISSILE) BattleDamageProcess();

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone_send.cpp:1008:31: warning: suggest parentheses around '&&' within '||' [-Wparentheses]

   else if(team == TEAM_YELLOW &&  irMessageReceive == BLUE_MISSILE || irMessageReceive == GREEN_MISSILE || irMessageReceive == RED_MISSILE || irMessageReceive == FREE_MISSILE) BattleDamageProcess();

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone_send.cpp:1009:29: warning: suggest parentheses around '&&' within '||' [-Wparentheses]

   else if(team == FREE_PLAY && irMessageReceive == RED_MISSILE || irMessageReceive == BLUE_MISSILE || irMessageReceive == GREEN_MISSILE || irMessageReceive == YELLOW_MISSILE || irMessageReceive == FREE_MISSILE) BattleDamageProcess();

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone_util.cpp: In member function 'void CoDroneClass::PrintDroneAddress()':

C:\Users\sterretje\Documents\Arduino\libraries\CoDrone-master\CoDrone_util.cpp:211:43: warning: array subscript has type 'char' [-Wchar-subscripts]

   DRONE_SERIAL.print(devAddressConnected[i],HEX);

                                           ^

Archiving built core (caching) in: C:\Users\sterretje\AppData\Local\Temp\arduino_cache_719822\core\core_arduino_avr_leonardo_4e759d11e131d256fe058d84342dcde1.a
Sketch uses 9730 bytes (33%) of program storage space. Maximum is 28672 bytes.
Global variables use 1236 bytes (48%) of dynamic memory, leaving 1324 bytes for local variables. Maximum is 2560 bytes.