View Single Post
Posts: 202 | Thanked: 385 times | Joined on Jul 2018
#107
Originally Posted by pichlo View Post
You pretty much figured it out yourself. qMin returns a double, so
Code:
qMin(qMin(s.width() / 2, s.height() / 2), f)
is seen by the compiler as
Code:
qMin(double, whatever_type_f_is)
If f is float, convert it to double. The best solution would be to make it double to start with, but if that is not practical, simply cast it:
Code:
qMin(qMin(s.width() / 2, s.height() / 2), double(f))
C++ is funny like that. In C, the conversion from float to double is automatic. C++ thinks it's too cool for that.

EDIT:
In this case, C++ cannot convert automatically because qMin is a template and requires the same type for both parameters. The compiler does not know whether to convert them both to float or to double, so it gives up and throws a wobbly. I still think it should be smart enough to convert them both to the wider type, but as I say, C++ can be funny sometimes.
Thanks - double(f)) did the trick. I still couldn't get rpm to build, since the build was creating a /usr/lib.. directory in BUILDROOT iwhile the app needed a /usr/lib64... directory, but all the proper files were created, so I could easily copy manually. Any insight there would be appreciated, jist out of curiosity ...
 

The Following User Says Thank You to levone1 For This Useful Post: