Using two headers with the same function names

此生再无相见时 提交于 2019-12-25 07:26:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!