Upgraded to arduino 2.04, now getting compile error

Installed arduino 2.04 on new pc. Windows 10 pro
Installed all the previously used libraries needed for sketch.
Specifically, Adafruit HX8357 v 1.1.15 is installed.
I needed to reprogram teensy 4.1 that is attached to this display
3.5 TFT 320x480 + Touchscreen Breakout Board w/MicroSD Socket [HXD8357D] : ID 2050 : $39.95 : Adafruit Industries, Unique & fun DIY electronics and kits.
Relevant part of the sketch below:

/* button box has 6 potentiometers,5 buttons and one display
 *  two of the buttons function to page the display forward and back
 *  TOOLS->USB TYPE-> serial/keyboard/mouse/joystick
*/
#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_HX8357.h"
#include <Bounce.h>

#define TFT_CS 10
#define TFT_DC 9
#define TFT_RST 8 6
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
//array of potentiometer pins
char potPins[] = {
A0,A1,A2,A3,A4,A10
}; 
byte potCount = 6;  
int inputPot = 0;  
int screenNumber = 1; 

Compile error now:

C:\Users\Stefan\Documents\Arduino\ButtonPotScreenTeensyFINAL\ButtonPotScreenTeensyFINAL.ino:13:38: error: expected primary-expression before '(' token
   13 | Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
      |                                      ^
C:\Users\Stefan\Documents\Arduino\ButtonPotScreenTeensyFINAL\ButtonPotScreenTeensyFINAL.ino:12:19: error: expected ')' before numeric constant
   12 | #define TFT_RST 8 6
      |                   ^
C:\Users\Stefan\Documents\Arduino\ButtonPotScreenTeensyFINAL\ButtonPotScreenTeensyFINAL.ino:13:55: note: in expansion of macro 'TFT_RST'
   13 | Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
      |                                                       ^~~~~~~
C:\Users\Stefan\Documents\Arduino\ButtonPotScreenTeensyFINAL\ButtonPotScreenTeensyFINAL.ino:13:38: note: to match this '('
   13 | Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
      |                                      ^

exit status 1

It used to compile fine on my other pc with arduino 1.89

1 Like

What is that?
#define is a macro which just replaces the name with whatever comes after it, in this case two numbers, an 8 and a 6, separated by a space.

So this line is essentially compiled as:

Adafruit_HX8357 tft = Adafruit_HX8357(10, 9, 8 6);

Note you have 4 parameters in the call, and the third one has no comma after it.
That will never compile on any proper C compiler.

  • Wes
1 Like

Thank you that worked

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.