OpenBoard-org / OpenBoard

OpenBoard is a cross-platform interactive whiteboard application intended for use in a classroom setting.
https://openboard.ch/
GNU General Public License v3.0
2.33k stars 423 forks source link

[Building/Packaging] ‘std::optional’ has not been declared - Linux #1092

Open sebojolais opened 4 days ago

sebojolais commented 4 days ago

-> A solution : if I add #include <optional> at the beginning of UBGraphicsScene.h, the building process finishes as expected.

sebojolais commented 4 days ago

Here is the build output:

x86_64-linux-gnu-g++ -c -m64 -pipe -std=c++11 -fopenmp -O2 -std=gnu++1z -w -D_REENTRANT -fPIC -DQT_DISABLE_DEPRECATED_BEFORE=0x050900 -DQT_DEPRECATED_WARNINGS -DQAPPLICATION_CLASS=QApplication -DNO_THIRD_PARTY_WARNINGS -DUBVERSION="\"1.7.2-a.240815."\" -DUBVERSION_RC=1,7,2,160,240815 -DPRE_RELEASE -DQT_NO_DEBUG -DQT_SVG_LIB -DQT_UITOOLS_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_WEBENGINEWIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_WEBENGINECORE_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_WEBCHANNEL_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_XML_LIB -DQT_POSITIONING_LIB -DQT_CONCURRENT_LIB -DQT_DBUS_LIB -DQT_CORE_LIB -Isrc -Isrc/singleapplication -Isrc/pdf-merger -Iplugins/cffadaptor/src -I/usr/include/quazip5 -I/usr/include/poppler -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtSvg -I/usr/include/x86_64-linux-gnu/qt5/QtUiTools -I/usr/include/x86_64-linux-gnu/qt5/QtMultimediaWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtWebEngineWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtMultimedia -I/usr/include/x86_64-linux-gnu/qt5/QtWebEngineCore -I/usr/include/x86_64-linux-gnu/qt5/QtQuick -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtQmlModels -I/usr/include/x86_64-linux-gnu/qt5/QtWebChannel -I/usr/include/x86_64-linux-gnu/qt5/QtQml -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtXml -I/usr/include/x86_64-linux-gnu/qt5/QtPositioning -I/usr/include/x86_64-linux-gnu/qt5/QtConcurrent -I/usr/include/x86_64-linux-gnu/qt5/QtDBus -I/usr/include/x86_64-linux-gnu/qt5/QtCore -Ibuild/linux/release/moc -Ibuild/linux/release/ui -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o build/linux/release/objects/UBExportFullPDF.o src/adaptors/UBExportFullPDF.cpp
In file included from src/core/UBSceneCache.h:38,
                 from src/core/UBPersistenceManager.h:34,
                 from src/adaptors/UBExportPDF.cpp:41:
src/domain/UBGraphicsScene.h:252:69: error: ‘std::optional’ has not been declared
  252 |         QPointF snap(const QPointF& point, double* force = nullptr, std::optional<QPointF> proposedPoint = {}) const;
      |                                                                     ^~~
src/domain/UBGraphicsScene.h:252:82: error: expected ‘,’ or ‘...’ before ‘<’ token
  252 |         QPointF snap(const QPointF& point, double* force = nullptr, std::optional<QPointF> proposedPoint = {}) const;
      |                                                                                  ^
src/domain/UBGraphicsScene.h:252:69: error: default argument missing for parameter 3 of ‘QPointF UBGraphicsScene::snap(const QPointF&, double*, int) const’
  252 |         QPointF snap(const QPointF& point, double* force = nullptr, std::optional<QPointF> proposedPoint = {}) const;
      |                                                                     ^~~~~~~~~~~~~
src/domain/UBGraphicsScene.h:252:52: note: ...following parameter 2 which has a default argument
  252 |         QPointF snap(const QPointF& point, double* force = nullptr, std::optional<QPointF> proposedPoint = {}) const;
      |                                            ~~~~~~~~^~~~~~~~~~~~~~~
letsfindaway commented 4 days ago

Thanks for reporting! It does not happen in all cases, so I missed that.

Could you please create a PR adding the missing #include?

sebojolais commented 4 days ago

Thank you for your answer. The PR is here: #1093.