Compilation error with 1.8.4 and Adafruit ST7735 library

Hi,

I get the following error while compiling a sketch. Any pointers to this issue would be appreciated.

I hope non verbose is enough :slight_smile:

Thank you.

Arduino: 1.8.4 (Windows 10), Board: "Arduino Nano, ATmega328P"

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:161:12: error: expected unqualified-id before ',' token

       255 },                  //     255 = 500 ms delay

            ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:163:11: error: expected constructor, destructor, or type conversion before '=' token

   Rcmd1[] = {                 // Init for 7735R, part 1 (red or green tab)

           ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:198:13: error: expected unqualified-id before ',' token

       0x05 },                 //     16-bit color

             ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:200:16: error: expected constructor, destructor, or type conversion before '=' token

   Rcmd2green[] = {            // Init for 7735R, part 2 (green tab only)

                ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:207:24: error: expected unqualified-id before ',' token

       0x00, 0x9F+0x01 },      //     XEND = 159

                        ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:208:14: error: expected constructor, destructor, or type conversion before '=' token

   Rcmd2red[] = {              // Init for 7735R, part 2 (red tab only)

              ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:215:19: error: expected unqualified-id before ',' token

       0x00, 0x9F },           //     XEND = 159

                   ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:217:11: error: expected constructor, destructor, or type conversion before '=' token

   Rcmd3[] = {                 // Init for 7735R, part 3 (red or green tab)

           ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::initB()':

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:306:14: error: 'Bcmd' was not declared in this scope

   commonInit(Bcmd);

              ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::initR(uint8_t)':

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:312:14: error: 'Rcmd1' was not declared in this scope

   commonInit(Rcmd1);

              ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:314:17: error: 'Rcmd2green' was not declared in this scope

     commandList(Rcmd2green);

                 ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:319:17: error: 'Rcmd2red' was not declared in this scope

     commandList(Rcmd2red);

                 ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:321:15: error: 'Rcmd3' was not declared in this scope

   commandList(Rcmd3);

               ^

Using library AdafruitGFX in folder: C:\Users\Andy\Dropbox\CODE\libraries\AdafruitGFX (legacy)
Using library AdafruitST7735 in folder: C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735 (legacy)
Using library Arduino-PID-Library-master at version 1.2.1 in folder: C:\Users\Andy\Dropbox\CODE\libraries\Arduino-PID-Library-master 
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI 
Using library SD at version 1.1.1 in folder: C:\Program Files (x86)\Arduino\libraries\SD 
exit status 1
Error compiling for board Arduino Nano.

It looks like an issue with the comma. Check your code. Something is wrong there, maybe it's even before the #include where this is included.

wvmarle:
It looks like an issue with the comma. Check your code. Something is wrong there, maybe it's even before the #include where this is included.

Thanks, I deleted the first lines of the error for no good reason... does this not highlight an issue with the cpp rather than the sketch? I can't seem to open the cpp file within the arduino ide.

Arduino: 1.8.4 (Windows 10), Board: "Arduino Nano, ATmega328P"

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:103:16: error: 'prog_uchar' does not name a type

 PROGMEM static prog_uchar

                ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:161:12: error: expected unqualified-id before ',' token

       255 },                  //     255 = 500 ms delay

            ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:163:11: error: expected constructor, destructor, or type conversion before '=' token

   Rcmd1[] = {                 // Init for 7735R, part 1 (red or green tab)

           ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:198:13: error: expected unqualified-id before ',' token

       0x05 },                 //     16-bit color

             ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:200:16: error: expected constructor, destructor, or type conversion before '=' token

   Rcmd2green[] = {            // Init for 7735R, part 2 (green tab only)

                ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:207:24: error: expected unqualified-id before ',' token

       0x00, 0x9F+0x01 },      //     XEND = 159

                        ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:208:14: error: expected constructor, destructor, or type conversion before '=' token

   Rcmd2red[] = {              // Init for 7735R, part 2 (red tab only)

              ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:215:19: error: expected unqualified-id before ',' token

       0x00, 0x9F },           //     XEND = 159

                   ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:217:11: error: expected constructor, destructor, or type conversion before '=' token

   Rcmd3[] = {                 // Init for 7735R, part 3 (red or green tab)

           ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::initB()':

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:306:14: error: 'Bcmd' was not declared in this scope

   commonInit(Bcmd);

              ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::initR(uint8_t)':

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:312:14: error: 'Rcmd1' was not declared in this scope

   commonInit(Rcmd1);

              ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:314:17: error: 'Rcmd2green' was not declared in this scope

     commandList(Rcmd2green);

                 ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:319:17: error: 'Rcmd2red' was not declared in this scope

     commandList(Rcmd2red);

                 ^

C:\Users\Andy\Dropbox\CODE\libraries\AdafruitST7735\Adafruit_ST7735.cpp:321:15: error: 'Rcmd3' was not declared in this scope

   commandList(Rcmd3);

               ^

exit status 1
Error compiling for board Arduino Nano.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Thanks for the help but the lib must have been corrupt. I re-downloaded the lib from github and installed it from the zip. Now works as expected. Phew.

PROGMEM static prog_uchar

That indicates that you must have had an older version. The "prog" types have been depricated for a while.

Delta_G:

PROGMEM static prog_uchar

That indicates that you must have had an older version. The "prog" types have been depricated for a while.

Ahhh, that makes sense. Thanks.

negativ3:
Thanks, I deleted the first lines of the error for no good reason... does this not highlight an issue with the cpp rather than the sketch? I can't seem to open the cpp file within the arduino ide.

The Arduino IDE indeed won't open .cpp or .h files - you have to use a separate editor for that.

This being C, compile errors can come from somewhere else. It's sometimes really surprising how far down the missing } the compiler finally throws an error.

wvmarle:
The Arduino IDE indeed won't open .cpp or .h files - you have to use a separate editor for that.

This being C, compile errors can come from somewhere else. It's sometimes really surprising how far down the missing } the compiler finally throws an error.

Thanks. Would Atmel Studio be more appropriate?

Hi,
A simple text editor will open those files so you can read them.

Tom.. :slight_smile: