问题
I want to use some of the functionality of <termios.h
and <asm/termios.h>
, but they contain functions with the same name, and only including them both I got error: redefinition of 'struct termio'.
I managed to use some of <asm/termios.h
structures (struct termios2
) by isolating the #include
directive exactly where I need (in a function).
void MyClass::MyMethod() {
#include <asm/termios.h>
struct termios2 tio;
// do stuff with tio variable.
}
This works fine for only one function, but if I try to do the same with more functions (including the <asm/termios.h>
header) I get aggregate 'MyClass::MyMethod()::termios2 tio' has incomplete type and cannot be defined
Any solutions?
来源:https://stackoverflow.com/questions/37697155/using-two-headers-with-the-same-function-names