Well, I think I am having issues with resolving two functions with the same name and I do not know how to resolve it.
I have a Qt class which is a subclass of QDialog (Qt). I would like to use 'fstat' to get information about the file using a code like below
struct stat file_info;
int hd = open("/home/test/file.xml", O_RDONLY);
fstat(hd, &file_info);
close(hd);
But when I do this, I get this complain from the compiler.
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()
Is there some way to resolve this?
Thanks.
Answer:
As Caladan mentions, ::open() did the trick. Also the second answer (to use stat instead of fstat) was equally valid. Thanks!
You can try calling ::open() which will hint the compiler it should not look in the current scope.
You can also use stat() which just gets the file name instead of a descriptor.
Do you have these header files included?
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.