Problem with qreal, double and float porting an application

Sid Boyce
Attachment: cusdr_receiver.cpp (16.85 KB)
System is an ODROID-X.
root@odroid:/1/cuSDR32# uname -a
Linux odroid 3.8.13.14 #1 SMP PREEMPT Sat Dec 21 22:14:31 UTC 2013 armv7l
armv7l armv7l GNU/Linux

root@odroid:/1/cuSDR32# cat /etc/os-release
NAME="Ubuntu"
VERSION="13.10, Saucy Salamander"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 13.10"
VERSION_ID="13.10"
HOME_URL="http://www.ubuntu.com/";
SUPPORT_URL="http://help.ubuntu.com/";
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/";

The failures and the offending lines below.
-------------------------------------------------------
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_MULTIMEDIA_LIB -DQT_OPENGL_LIB
-DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
-I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore
-I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui
-I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtMultimedia
-I/usr/include/qt4 -I/usr/include/QtMultimediaKit -I/usr/include/QtMobility
-I. -Isrc -Isrc/AudioEngine -Isrc/CL -Isrc/DataEngine -Isrc/GL -Isrc/QtDSP
-Isrc/Util -I/usr/X11R6/include -Ibld/moc -o bld/o/qtdsp_wpagc.o
src/QtDSP/qtdsp_wpagc.cpp
src/QtDSP/qtdsp_wpagc.cpp: In member function ‘void
QWPAGC::ProcessAGC(CPX&, CPX&, int)’:
src/QtDSP/qtdsp_wpagc.cpp:290:88: error: no matching function for call to
‘qMin(double, float)’
mult = (m_out_target - m_slope_constant * qMin(0.0, log10 (m_inv_max_input
* m_volts))) / m_volts;
^
src/QtDSP/qtdsp_wpagc.cpp:290:88: note: candidate is:
In file included from /usr/include/qt4/QtCore/qiterator.h:45:0,
from /usr/include/qt4/QtCore/qvector.h:45,
from /usr/include/qt4/QtCore/QVector:1,
from src/QtDSP/qtdsp_qComplex.h:34,
from src/QtDSP/qtdsp_wpagc.h:36,
from src/QtDSP/qtdsp_wpagc.cpp:34:
/usr/include/qt4/QtCore/qglobal.h:1213:34: note: template<class T> const T&
qMin(const T&, const T&)
Q_DECL_CONSTEXPR inline const T &qMin(const T &a, const T &b) { return (a <
b) ? a : b; }
^
/usr/include/qt4/QtCore/qglobal.h:1213:34: note: template argument
deduction/substitution failed:
src/QtDSP/qtdsp_wpagc.cpp:290:88: note: deduced conflicting types for
parameter ‘const T’ (‘double’ and ‘float’)
mult = (m_out_target - m_slope_constant * qMin(0.0, log10 (m_inv_max_input
* m_volts))) / m_volts;
^
src/QtDSP/qtdsp_wpagc.cpp: In member function ‘void
QWPAGC::setHangLevelDb(qreal)’:
src/QtDSP/qtdsp_wpagc.cpp:588:78: error: no matching function for call to
‘qMax(double, qreal)’
qreal tmp = qMax(1.0e-8, (convert - m_minVolts) / (m_maxInput -
m_minVolts));
^
src/QtDSP/qtdsp_wpagc.cpp:588:78: note: candidate is:
In file included from /usr/include/qt4/QtCore/qiterator.h:45:0,
from /usr/include/qt4/QtCore/qvector.h:45,
from /usr/include/qt4/QtCore/QVector:1,
from src/QtDSP/qtdsp_qComplex.h:34,
from src/QtDSP/qtdsp_wpagc.h:36,
from src/QtDSP/qtdsp_wpagc.cpp:34:
/usr/include/qt4/QtCore/qglobal.h:1215:34: note: template<class T> const T&
qMax(const T&, const T&)
Q_DECL_CONSTEXPR inline const T &qMax(const T &a, const T &b) { return (a <
b) ? b : a; }
^
/usr/include/qt4/QtCore/qglobal.h:1215:34: note: template argument
deduction/substitution failed:
src/QtDSP/qtdsp_wpagc.cpp:588:78: note: deduced conflicting types for
parameter ‘const T’ (‘double’ and ‘qreal {aka float}’)
qreal tmp = qMax(1.0e-8, (convert - m_minVolts) / (m_maxInput -
m_minVolts));
^
make: *** [bld/o/qtdsp_wpagc.o] Error 1
root@odroid:/1/cuSDR32#
svn co http://svn.tapr.org/repos_sdr_hpsdr/trunk/DL3HVH/cuSDR32/ for the
full source.

davef
Think you have better luck here:
http://forum.odroid.com/index.php

Sid Boyce
Thanks.
I'll give that a try also but it's not only an ODROID problem, it's a
general one on ARM.
The same happens on Pandaboard and there are also many reports on Google,
except I haven't found a way to fix this, but I have fixed a couple of
others I came across.

davef
Can you find where functions qMin and qMax are?

I see those are preceded by 

template argument deduction/substitution failed:

Are they just warnings?

 
It may be ARM, but quite a different architecture.

Good luck!

Sid Boyce
Apologies I have not looked here in quite a while.
I got over the problem by recursively converting qreal to double.
# find . -type f -print0 | xargs -0 sed -i 's/qreal/double/g'

The next problem I have is with GL headers which seem to be incompatibility
between the mali400 headers and mesa.