-2

I'm attempting to use classes in Arduino, so far its working successfully however I cannot reference a .H file more than once.

Error compiling for board... "multiple definition of `variable'"

I am basically looking to create a 'variables' class that multiple .cpp files can have access to. Any ideas on how to approach this?

This is different from "What should go into an .h file? " As its not the structure of the .H or .cpp file i necessarily need help with.

In c# I would create a class called for example Variables and then access them from any other class using Variables.Time... Any file can access this class and update the variables. However in Arduino it seems I am only able to access it from 1 file, whereas I need to access it from a library created in tabbed form and from the main .ino

charley
  • 87
  • 4
  • 17

1 Answers1

0

Try Adding a #pragma once to the top of your .h file.

Suraj S
  • 1,019
  • 7
  • 18