好吧,我想我在解析两个具有相同名称的函数时遇到了问题,我不知道如何解决它。
我有一个 Qt 类,它是 QDialog (Qt) 的子类。我想使用“fstat”通过如下代码获取有关文件的信息
struct stat file_info;
int hd = open("/home/test/file.xml", O_RDONLY);
fstat(hd, &file_info);
close(hd);
但是当我这样做时,我从编译器那里得到了这个提示。
error: no matching function for call to 'Test::open(const char [19], int)'
/usr/local/Trolltech/Qt-4.7.3/include/QtGui/qdialog.h::99:10: note: candidate is: void QDialog::open()
有什么办法可以解决吗?
谢谢。
答案:
作为Caladan提到,::open() 成功了。第二个答案(使用 stat 而不是 fstat)同样有效。谢谢!
最佳答案
您可以尝试调用::open() ,这将提示编译器它不应该在当前范围内查找。
您还可以使用 stat() 来获取文件名而不是描述符。
关于c++ - 将 fstat 与 Qt QDialog 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12814754/