hi, LOR.
что-то тут не так. есть идеи?
$ls
wtf.cpp wtf.h
$cat wtf.h
#include <QSettings>
class C : public QSettings
{
Q_OBJECT
public:
C():QSettings("1","2"){}
int value(int key, int def) {
return value(QString::number(key), QVariant(def)).toInt();
}
};
$cat wtf.cpp
#include "wtf.h"
int main()
{
QSettings s("1","2");
s.value("3","123");
C c;
c.value(3,123);
c.value(QString::number(3),QVariant(123));
return 0;
}
$qmake-qt4 -project
$qmake-qt4
$make
g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I. -o wtf.o wtf.cpp
In file included from wtf.cpp:2:
wtf.h: In member function ‘int C::value(int, int)’:
wtf.h:8: error: no matching function for call to ‘C::value(QString, QVariant)’
wtf.h:7: note: candidates are: int C::value(int, int)
wtf.cpp: In function ‘int main()’:
wtf.cpp:9: error: no matching function for call to ‘C::value(QString, QVariant)’
wtf.h:7: note: candidates are: int C::value(int, int)
make: *** [wtf.o] Error 1
$g++ --version
g++ (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7)
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
PS: гуглил, но не глубоко...
PPS: в таком варианте ошибки на этой строке не возникает:
int value(int key, int def) {
return QSettings::value(QString::number(key), QVariant(def)).toInt();
}