variable names and defines conflict

I wrote a class for my app and it contains particular variable names. For example, bool B50.
Now I need to #include termios.h to my class becasue I will use it in my code.
So, as there is a #define B50 000001 inside termios.h so it interferes with my variable name.

A compiler error arises saying: error: expected unqualified-id before numeric constant

How to solve it? It happens with many of my variables and I cant change their names just because such names are macros inside termios.h. How I can wrap termios.h inside a namespace or something similar?

Thank you very much.
Last edited on
This is why macros are evil - they are processed before the compiler even understands any of the code. You cannot put them in a namespace - they are always global. You can undefine them, however.
1
2
3
#undef B50
#undef B51
//... 
Thank you for the very fast response.

That is the only solution I have? Because, they are needed to operate with termios.
Cannot I use namespace in my class?

Anyway, thenk you very much for your response.
No, namespaces don't exist at the time when the preprocessor replaces macros. You either need to use different variable names or you have to undefine the macros.
LB, you simply cannot be more clear!. I understood every word.
Thank you very much. It saved me a lot of time.
Topic archived. No new replies allowed.