Error: expected primary-expression before '.' token

I'm having trouble with the coding side of my project. Here is my code:

void setup() {   ~~~~~~~~~~   const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;   LiquidCrystal lcd(rs, en, d4, d5, d6, d7);   lcd.begin(16, 2);

  Serial.begin(9600); }

void loop() {

  ~~~~~~~   lcd.print(Tc);   lcd.setCursor(00, 1);   lcd.print(Tf);

  delay(1000); ~~~~~~~~~~~~~~~~~~~~~~ ```

When I try to verify it, I get the error:

exit status 1
expected primary-expression before '.' token

What am I doing wrong?

I apologize, but I removed most of the code after 12 hours and helpful responses because I am using it for part of a competition, and I don't want competitors to be able to use it. Sorry. (The removed code is represented by ~~~~~~~~.)

Line 2 code in your sketch is the issue.

Look at the examples in the reference that show you how to declare the lcd object.

#define lcd

lcd is defined as having no value

So, as far as the compiler is concerned it sees




hence the error

Did you actually mean to declare an instance of the LCD library with the name lcd ? You have actually done that in setup()   LiquidCrystal lcd(rs, en, d4, d5, d6, d7);but that means you can only use it in setup(). Move the declaration outside of any function to make it available globally

I was able to make it work by deleting my 2nd line, and moving LiquidCrystal lcd(rs, en, d4, d5, d6, d7); into the loop().

Thanks everyone!