我现在正在尝试用Qt4.7编译sqlitebrowser,在编译运行时我得到了他的错误:
g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt4/QtGui -I/usr/local/include/qt4/Qt3Support -I/usr/local/include/qt4 -Isqlite_source -I.moc -I/usr/local/include -o .obj/extendedmainform.o extendedmainform.cpp
In file included from findform.h:24,
from form1.h:31,
from extendedmainform.h:4,
from extendedmainform.cpp:1:
sqlitedb.h: In constructor 'DBBrowserField::DBBrowserField()':
sqlitedb.h:44: error: call of overloaded 'QString(int)' is ambiguous
/usr/local/include/qt4/QtCore/qstring.h:428: note: candidates are: QString::QString(const QByteArray&)
/usr/local/include/qt4/QtCore/qstring.h:426: note: QString::QString(const char*)
/usr/local/include/qt4/QtCore/qstring.h:728: note: QString::QString(const QString&)
/usr/local/include/qt4/QtCore/qstring.h:106: note: QString::QString(QChar)
/usr/local/include/qt4/QtCore/qstring.h:105: note: QString::QString(const QChar*)
sqlitedb.h: In constructor 'DBBrowserIndex::DBBrowserIndex()':
sqlitedb.h:58: error: call of overloaded 'QString(int)' is ambiguous
/usr/local/include/qt4/QtCore/qstring.h:428: note: candidates are: QString::QString(const QByteArray&)
/usr/local/include/qt4/QtCore/qstring.h:426: note: QString::QString(const char*)
/usr/local/include/qt4/QtCore/qstring.h:728: note: QString::QString(const QString&)
/usr/local/include/qt4/QtCore/qstring.h:106: note: QString::QString(QChar)
/usr/local/include/qt4/QtCore/qstring.h:105: note: QString::QString(const QChar*)
sqlitedb.h: In constructor 'DBBrowserTable::DBBrowserTable()':
sqlitedb.h:73: error: call of overloaded 'QString(int)' is ambiguous
/usr/local/include/qt4/QtCore/qstring.h:428: note: candidates are: QString::QString(const QByteArray&)
/usr/local/include/qt4/QtCore/qstring.h:426: note: QString::QString(const char*)
/usr/local/include/qt4/QtCore/qstring.h:728: note: QString::QString(const QString&)
/usr/local/include/qt4/QtCore/qstring.h:106: note: QString::QString(QChar)
/usr/local/include/qt4/QtCore/qstring.h:105: note: QString::QString(const QChar*)
*** Error code 1我查看了Qt文档( 4.6和4.7)以查看Qstring构造函数中的任何更改,但我只看到一个新的one overload,所以我的问题是,为了编译它,我需要在sqlitebrowser中进行哪些更改。
发布于 2011-04-13 23:01:57
根据QString in Qt 4.6的说法,只有one candidate可以将指针作为参数。但是在Qt 4.7中有两个可以接受指针作为参数的QString构造函数。我认为这引发了编译器错误。
您可以强制它像Qt 4.6一样运行,如下所示:
name((const char*) 0)发布于 2011-04-13 21:42:33
无论您在创建带有int的QString时,都需要告诉Qt您所说的int是什么意思
如果是要转换为字符串的实际文字数字,请使用QString("%u").arg()函数
https://stackoverflow.com/questions/5650208
复制相似问题