You are not logged in.

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