jveitchmichaelis / deeplabel

A cross-platform desktop image annotation tool for machine learning
205 stars 39 forks source link

Error error: no member named 'clamp' in namespace 'std' #22

Closed marcfielding1 closed 3 years ago

marcfielding1 commented 3 years ago

Heya I'm trying to compile for MacOS I'm getting...

marcfielding@MacBook-Pro deeplabel % make -j4
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -mmacosx-version-min=10.12 -O2 -std=gnu++1y  -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.13 -Wall -Wextra -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_TESTLIB_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"/Users/marcfielding/deeplabel"' -I. -I/usr/local/include/opencv4 -Isrc -IQtAwesome/QtAwesome -I/usr/local/Cellar/qt/5.15.0/lib/QtWidgets.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtSql.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtTest.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtConcurrent.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers -I.moc -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/usr/local/Cellar/qt/5.15.0/mkspecs/macx-clang -F/usr/local/Cellar/qt/5.15.0/lib -o .obj/darknetexporter.o src/darknetexporter.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -mmacosx-version-min=10.12 -O2 -std=gnu++1y  -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.13 -Wall -Wextra -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_TESTLIB_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"/Users/marcfielding/deeplabel"' -I. -I/usr/local/include/opencv4 -Isrc -IQtAwesome/QtAwesome -I/usr/local/Cellar/qt/5.15.0/lib/QtWidgets.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtSql.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtTest.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtConcurrent.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers -I.moc -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/usr/local/Cellar/qt/5.15.0/mkspecs/macx-clang -F/usr/local/Cellar/qt/5.15.0/lib -o .obj/baseimporter.o src/baseimporter.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -mmacosx-version-min=10.12 -O2 -std=gnu++1y  -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.13 -Wall -Wextra -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_TESTLIB_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"/Users/marcfielding/deeplabel"' -I. -I/usr/local/include/opencv4 -Isrc -IQtAwesome/QtAwesome -I/usr/local/Cellar/qt/5.15.0/lib/QtWidgets.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtSql.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtTest.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtConcurrent.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers -I.moc -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/usr/local/Cellar/qt/5.15.0/mkspecs/macx-clang -F/usr/local/Cellar/qt/5.15.0/lib -o .obj/cocoexporter.o src/cocoexporter.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -mmacosx-version-min=10.12 -O2 -std=gnu++1y  -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.13 -Wall -Wextra -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_TESTLIB_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"/Users/marcfielding/deeplabel"' -I. -I/usr/local/include/opencv4 -Isrc -IQtAwesome/QtAwesome -I/usr/local/Cellar/qt/5.15.0/lib/QtWidgets.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtSql.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtTest.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtConcurrent.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers -I.moc -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/usr/local/Cellar/qt/5.15.0/mkspecs/macx-clang -F/usr/local/Cellar/qt/5.15.0/lib -o .obj/darknetimporter.o src/darknetimporter.cpp
src/darknetexporter.cpp:51:29: error: no member named 'clamp' in namespace 'std'
            double x = std::clamp(static_cast<double>(label.rect.center().x())/image.cols, 0, 0.999);
                       ~~~~~^
src/darknetexporter.cpp:52:29: error: no member named 'clamp' in namespace 'std'
            double y = std::clamp(static_cast<double>(label.rect.center().y())/image.rows, 0, 0.999);
                       ~~~~~^
src/darknetexporter.cpp:53:33: error: no member named 'clamp' in namespace 'std'
            double width = std::clamp(static_cast<double>(label.rect.width())/image.cols, 0, 0.999);
                           ~~~~~^
src/darknetexporter.cpp:54:34: error: no member named 'clamp' in namespace 'std'
            double height = std::clamp(static_cast<double>(label.rect.height())/image.rows, 0, 0.999);
                            ~~~~~^
4 errors generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -mmacosx-version-min=10.12 -O2 -std=gnu++1y  -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.13 -Wall -Wextra -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_TESTLIB_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"/Users/marcfielding/deeplabel"' -I. -I/usr/local/include/opencv4 -Isrc -IQtAwesome/QtAwesome -I/usr/local/Cellar/qt/5.15.0/lib/QtWidgets.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtSql.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtTest.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtConcurrent.framework/Headers -I/usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers -I.moc -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I/usr/local/Cellar/qt/5.15.0/mkspecs/macx-clang -F/usr/local/Cellar/qt/5.15.0/lib -o .obj/gcpexporter.o src/gcpexporter.cpp
make: *** [.obj/darknetexporter.o] Error 1
make: *** Waiting for unfinished jobs....
marcfielding1 commented 3 years ago

So I got this working by brew installing qt opencv then downloading from the releases page :-) Would still be interested to see how you fix this though.

jveitchmichaelis commented 3 years ago

Ah this is a quick fix - std::clamp is a c++17 thing and I didn't realise. The automatic mac build uses c++14 I think. So you can just remove those calls for the moment (in the darknet export code)

On Mon, Aug 24, 2020, 13:24 Marc Fielding notifications@github.com wrote:

So I got this working by brew installing qt opencv then downloading from the releases page :-) Would still be interested to see how you fix this though.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jveitchmichaelis/deeplabel/issues/22#issuecomment-679094765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDMJ5CCQ6FHDHAZ5FVBTTSCJLXBANCNFSM4QJNYYQA .

marcfielding1 commented 3 years ago

Ahh gotcha, yeah I can have a go! It's been years since I touched C++ but i'll see if I can knock up a PR also!

jveitchmichaelis commented 3 years ago

I've added c++17 to the .pro file - you can try that as well. We'll see if Travis likes it :)

jveitchmichaelis commented 3 years ago

Fixed https://github.com/jveitchmichaelis/deeplabel/commit/ee8ed5aecf2da76cbe8034e11092ad71fa94fb3b