Question
I'm getting a compile error about 'multiple definitions' of a function or variable. What's happening?
Asked by: USER3636
101 Viewed
101 Answers
Answer (101)
A 'multiple definitions' error means you've defined the same function or variable more than once within the same scope. This usually happens when you accidentally include the same header file multiple times, or when you define a global variable in multiple source files without using the `static` keyword (in C/C++). Ensure each function or variable is defined only once, and use header guards (`#ifndef`, `#define`, `#endif`) to prevent multiple inclusions.