You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Monday, December 29th 2014, 12:02pm

QString::arg() ambiguous ?

Can someone pleas explain why QT

Source code

1
2
3
4
5
#include <QString>
int main(int argc, char** argv) {
ushort n = 5;
QString s = QString("%1").arg(n, 2, 16, '0');
}

gives when compiled with g++ gives many warnings including

Source code

1
2
3
4
5
6
7
8
9
g++ -Wall -I/usr/include/QtCore	arg.cpp   -o arg
arg.cpp: In function 'int main(int, char**)':
... lots of similar warnings but finally
arg.cpp:5:46: warning: ISO C++ says that these are ambiguous, even though 
the worst conversion for the first is better than the worst conversion for the second:
/usr/include/QtCore/qstring.h:149:13: note: candidate 1: 
	QString QString::arg(double, int, char, int, const QChar&) const
/usr/include/QtCore/qstring.h:742:16: note: candidate 2: 
	QString QString::arg(ushort, int, int, const QC

I am totally lost. Help!!
Enno

2

Wednesday, January 14th 2015, 11:23am

Solved! Headers and library versions got out of step