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?
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.
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.