PDA

View Full Version : Error "QString::arg: Argument missing"



Lawand
18th February 2009, 20:07
When building and executing the following code:

#include <QString>
#include <iostream>

int main()
{
QString someString = QString("1%").arg("Hello World!");

std::cout << someString.toStdString();

return 0;
}

I get this output:

QString::arg: Argument missing: 1%, Hello World!
1%

which includes the error message "QString::arg: Argument missing", why am I getting this??

Thanks in advance.

gruszczy
18th February 2009, 20:21
It should be %1, not 1%.

lni
18th February 2009, 20:22
Change 1% -> %1

Lawand
18th February 2009, 20:26
Hello World!
Thanks gruszczy, the problem drove me crazy, but now it's solved :)