Library Variable conflicts

I can't claim to be a C expert, having gone about learning it ad hoc by playing with Arduinos. By now I've written at least 100,000 lines of Arduino, but I still don't really have a great mastery of it. If I get what I want, I'm happy.

But here is a new problem that arose a day ago. I downloaded the NewPing library, included it, and previously working code wouldn't compile. The compiler complained about a variable name conflict with some variable in the new ping library. At that point, I had no other libraries included, but when I commented out my timer1 code, all was well.

So my question is, if conflicts like this occur, is it generally possible to go rename a variable in conflicy and clear up the problem?

So my question is, if conflicts like this occur, is it generally possible to go rename a variable in conflicy and clear up the problem?

That depends what the conflict is. The NewPing class uses a timer to check whether the echo has returned, instead of waiting for it. If your code uses the same timer, you can't just rename a variable and resolve the conflict.

Ok,

I appreciate the answer, and it makes perfect sense based on the fact that when I changed my timer, the problem went away.

But in general, do #includes have immunity from overlapping variable names? I have found that to be true in some other programming contexts.

But in general, do #includes have immunity from overlapping variable names?

No.

If the file being included defines a class, and the class names are different, the class members can have the same name without conflict.

Any non-class members defined in a header file must be unique.