I'm using c++ to program an arduino. I am trying to separate each of my main systems into its own c++ and header file. I am using a library for the LCD but I'm having trouble using it. I want to declare it in lcd.h so that I can access it from any other script that wants to print to the LCD.
Upon building, I get this error:
1 2 3
.pioenvs\uno\src\window.cpp.o (symbol from plugin): In function `lcd':
(.text+0x0): multiple definition of `lcd'
.pioenvs\uno\src\lcd.cpp.o (symbol from plugin):(.text+0x0): first defined here
Below are some of my scripts (I have deleted irrelevant sections of the code).
//initialize lcd for 16 columns and 2 rows
//inform user that the system is Initializing
You are creating an object named lcd in a header. You are then including that header in two different cpp files, so you have two files with the same object being created in them. You are not allowed to create the same object twice in one program.