I'm trying to compile a code for bumper switches in my robot and i get this error:" Error - symbol 'tr' has multiple definitions." What does this mean? I'm painfully new to this...
Hi there.
In your code, you might have more then one definition for the variable tr
. e.g.
int tr = 0;
and in other part of the same code, or file
int tr = 0;
Do a search for tr
in your code to see if it being defined multiple times.
Cheers. Jas.
It depends whether you see the error at compile time or link time.
If you see it at link time (when building the program from object files), it means you have two or more object files, and the variable 'tr' (or function 'tr') is defined several times in different files.
If you see it at compile time (for a single file being converted to an object file), then you have defined the variable or function more than once in the given source file.
Maybe your header file (in which you might have declared tr
) is being included in the same .c
file multiple times.
One easy solution is to use Include Guards.