c++iosxcodeosx-yosemiteqt5.3

Call to funtion ambiguous when Compiling QT5.3 on OSX 10.10 Yosmite


I am trying to compile qt5.3 on OSX 10.10. When I run "make" I get the following error:

>cd widgets/ && ( test -e Makefile || /Volumes/Untitled/5.3/Src/qtbase/bin/qmake /Volumes/Untitled/5.3/Src/qtbase/src/widgets/widgets.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -O2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_EVDEV -DQT_NO_USING_NAMESPACE -DQT_BUILD_WIDGETS_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_STYLE_WINDOWSVISTA -DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_GTK -DQT_NO_STYLE_WINDOWSCE -DQT_NO_STYLE_WINDOWSMOBILE -DQT_NO_STYLE_ANDROID -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../../mkspecs/macx-clang -I. -I../../include -I../../include/QtWidgets -I../../include/QtWidgets/5.3.0 -I../../include/QtWidgets/5.3.0/QtWidgets -Idialogs -I.uic -I../../lib/QtGui.framework/Versions/5/Headers -I../../lib/QtGui.framework/Versions/5/Headers/5.3.0 -I../../lib/QtGui.framework/Versions/5/Headers/5.3.0/QtGui -I../../lib/QtCore.framework/Versions/5/Headers -I../../lib/QtCore.framework/Versions/5/Headers/5.3.0 -I../../lib/QtCore.framework/Versions/5/Headers/5.3.0/QtCore -I.moc -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AGL.framework/Headers -F/Volumes/Untitled/5.3/Src/qtbase/lib -o .obj/qlineedit_p.o widgets/qlineedit_p.cpp
widgets/qlineedit_p.cpp:352:15: error: call to 'qFuzzyCompare' is ambiguous
    setCursor(qFuzzyCompare(m_opacity, 1.0) || !parentWidget() ? QCurso...
              ^~~~~~~~~~~~~
../../include/QtCore/../../src/corelib/global/qglobal.h:725:37: note: 
      candidate function
Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2)
                                    ^
../../include/QtCore/../../src/corelib/global/qglobal.h:731:37: note: 
      candidate function
Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
                                    ^
../../include/QtGui/../../src/gui/painting/qmatrix.h:160:13: note: candidate
      function
inline bool qFuzzyCompare(const QMatrix& m1, const QMatrix& m2)
            ^
../../include/QtGui/../../src/gui/painting/qtransform.h:332:13: note: 
      candidate function
inline bool qFuzzyCompare(const QTransform& t1, const QTransform& t2)
            ^
1 error generated.
make[3]: *** [.obj/qlineedit_p.o] Error 1
make[2]: *** [sub-widgets-make_first] Error 2
make[1]: *** [sub-src-make_first] Error 2
>make: *** [module-qtbase-make_first] Error 2

The configure options I am using is:

./configure -release -opensource -confirm-license -qt-harfbuzz -qt-zlib -qt-libpng -qt-libjpeg -no-pch -qreal float -nomake examples -nomake tools -verbose -arch x86_64

Any help is much appreciated. Thanks.


Solution

  • http://doc.qt.io/qt-5/qtglobal.html#qreal-typedef

    You redefine qreal as float in your call. The default is double.

    The line that is called reads:

    setCursor(qFuzzyCompare(m_opacity, 1.0) || !parentWidget() ? QCursor(Qt::ArrowCursor) : parentWidget()->cursor());
    

    m_opacity is qreal, 1.0 is double. So the call qFuzzyCompare(float, double) is indeed ambigious.

    You have 2 options:

    If there is no need to redefine the type of qreal I would go with that.