C++ C++;类如何避免fcntl open与自定义open函数的冲突

C++ C++;类如何避免fcntl open与自定义open函数的冲突,c++,function,class,namespaces,C++,Function,Class,Namespaces,我在下面定义了一个类来操作uart: class UART : public IHALResource<std::string, uart_config> { private: const std::string PORTNAME; int fd; public: int32_t open() override; UART(std::string portName) : PORTNAME(portName){}; ~UART();

我在下面定义了一个类来操作uart:

class UART : public IHALResource<std::string, uart_config> {
   private:
    const std::string PORTNAME;
    int fd;

   public:
    int32_t open() override;
    UART(std::string portName) : PORTNAME(portName){};
    ~UART();
};

int32_t HAL::UART::open() {
    fd = open(PORTNAME.c_str(), O_RDWR | O_NOCTTY | O_SYNC);
    if (fd < 0) {
        printf("Error opening %s: %s\n", PORTNAME.c_str(), strerror(errno));
        return -1;
    }
}
class-UART:公共IHALResource{
私人:
常量std::字符串端口名;
int-fd;
公众:
int32_t open()覆盖;
UART(标准::字符串端口名):端口名(端口名){};
~UART();
};
int32_t HAL::UART::open(){
fd=open(PORTNAME.c_str(),O_RDWR | O|u NOCTTY | O|u SYNC);
如果(fd<0){
printf(“打开%s时出错:%s\n”,PORTNAME.c_str(),strerror(errno));
返回-1;
}
}
UART open方法中的open()函数,我希望使用fcntl中的open函数,而不是UART类中的open函数。但结果似乎是对的

有人能告诉我如何区分这两个“开放”函数吗


非常感谢

指定名称空间?我不知道fcntl到底是什么,但它可能在一个单独的名称空间中,否则会出现编译器错误,但fcntl的namsespace是什么?我找不到。看起来像是某种Linux操作系统的东西,可能是
::打开
使用全局名称空间谢谢@Tas!没错。谢谢你的帮助。也许你应该把它作为一个答案,我接受。指定名称空间?我不知道fcntl到底是什么,但它可能在一个单独的名称空间中,否则会出现编译器错误,但fcntl的namsespace是什么?我找不到。看起来像是某种Linux操作系统的东西,可能是
::打开
使用全局名称空间谢谢@Tas!没错。谢谢你的帮助。也许你应该这样回答,我会接受的。