Hey there,
for some reason, if i have a function which has QString Arguments and I pass it a char*, sometimes it works and sometimes I get an Error?
Why is this and how to work around?
Printable View
Hey there,
for some reason, if i have a function which has QString Arguments and I pass it a char*, sometimes it works and sometimes I get an Error?
Why is this and how to work around?
What error?Quote:
I get an Error?
Can you paste it here?
The function declaration:
How I call it:
The Error I get:
Code:
/home/finn/client_gallery/dirparser.cpp:24: error: no matching function for call to ‘SqlViaHttp::select(const char [5], QString&)’
//EDIT:
Ahh, ok, I know so the solution.
I have to use QString instead of QString& in the Declaration.
Why is that?
You don't have to change the declaration, you can change the way you use call the function.Quote:
I have to use QString instead of QString& in the Declaration.
Why is that?
You declared it with a reference, so you need to pass a reference, but you have passed a literal string.
Your declaration will work if you call it like this: