alandefreitas / matplotplusplus

Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
https://alandefreitas.github.io/matplotplusplus/
MIT License
4.1k stars 311 forks source link

Compilation fails with GCC 13 / Clang 16 #341

Closed tretre91 closed 1 year ago

tretre91 commented 1 year ago

Bug category

Describe the bug Compilation fails with GCC 13.1.1 and clang 16.0.2 because <cstdint> (which defines uint8_t) is not included in source/matplot/util/colors.cpp

Steps to Reproduce

cmake -S . -B build -DCMAKE_BUILD_TYPE=RELEASE -DMATPLOTPP_BUILD_EXAMPLES=OFF -DMATPLOTPP_BUILD_TESTS=OFF -DMATPLOTPP_BUILD_INSTALLER=OFF -DMATPLOTPP_BUILD_PACKAGE=OFF
cmake --build build

Output

```console $ cmake -S . -B build -DCMAKE_BUILD_TYPE=RELEASE -DMATPLOTPP_BUILD_EXAMPLES=OFF -DMATPLOTPP_BUILD_TESTS=OFF -DMATPLOTPP_BUILD_INSTALLER=OFF -DMATPLOTPP_BUILD_PACKAGE=OFF -- The C compiler identification is GNU 13.1.1 -- The CXX compiler identification is GNU 13.1.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.0") -- Found JPEG: /usr/lib64/libjpeg.so (found version "62") -- Found TIFF: /usr/lib64/libtiff.so (found version "4.4.0") -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.13") -- Found PNG: /usr/lib64/libpng.so (found version "1.6.37") -- Looking for sgemm_ -- Looking for sgemm_ - not found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Looking for sgemm_ -- Looking for sgemm_ - found -- Found BLAS: /usr/lib64/libopenblas.so -- Looking for cheev_ -- Looking for cheev_ - found -- Found LAPACK: /usr/lib64/libopenblas.so;-lm;-ldl -- Could NOT find FFTW (missing: FFTW_INCLUDE_DIRS) -- Looking for C++ include filesystem -- Looking for C++ include filesystem - found -- Performing Test CXX_FILESYSTEM_NO_LINK_NEEDED -- Performing Test CXX_FILESYSTEM_NO_LINK_NEEDED - Success -- Looking for __fbufsize -- Looking for __fbufsize - found -- Configuring done (3.1s) -- Generating done (0.0s) -- Build files have been written to: /tmp/matplotplusplus/build $ cmake --build build [ 2%] Building CXX object source/3rd_party/CMakeFiles/nodesoup.dir/nodesoup/src/algebra.cpp.o [ 4%] Building CXX object source/3rd_party/CMakeFiles/nodesoup.dir/nodesoup/src/fruchterman_reingold.cpp.o [ 6%] Building CXX object source/3rd_party/CMakeFiles/nodesoup.dir/nodesoup/src/kamada_kawai.cpp.o [ 9%] Building CXX object source/3rd_party/CMakeFiles/nodesoup.dir/nodesoup/src/layout.cpp.o [ 11%] Building CXX object source/3rd_party/CMakeFiles/nodesoup.dir/nodesoup/src/nodesoup.cpp.o [ 13%] Linking CXX static library libnodesoup.a [ 13%] Built target nodesoup [ 16%] Building CXX object source/matplot/CMakeFiles/matplot.dir/backend/backend_interface.cpp.o [ 18%] Building CXX object source/matplot/CMakeFiles/matplot.dir/backend/gnuplot.cpp.o [ 20%] Building CXX object source/matplot/CMakeFiles/matplot.dir/backend/backend_registry.cpp.o [ 23%] Building CXX object source/matplot/CMakeFiles/matplot.dir/core/axes_type.cpp.o [ 25%] Building CXX object source/matplot/CMakeFiles/matplot.dir/core/axes_object.cpp.o [ 27%] Building CXX object source/matplot/CMakeFiles/matplot.dir/core/axis_type.cpp.o [ 30%] Building CXX object source/matplot/CMakeFiles/matplot.dir/core/figure_type.cpp.o [ 32%] Building CXX object source/matplot/CMakeFiles/matplot.dir/core/figure_registry.cpp.o [ 34%] Building CXX object source/matplot/CMakeFiles/matplot.dir/core/legend.cpp.o [ 37%] Building CXX object source/matplot/CMakeFiles/matplot.dir/core/line_spec.cpp.o [ 39%] Building CXX object source/matplot/CMakeFiles/matplot.dir/util/colors.cpp.o /tmp/matplotplusplus/source/matplot/util/colors.cpp: Dans la fonction « std::array matplot::to_array(std::string_view) »: /tmp/matplotplusplus/source/matplot/util/colors.cpp:202:17: erreur: « uint8_t » n'a pas été déclaré dans cette portée 202 | uint8_t a = 0; | ^~~~~~~ /tmp/matplotplusplus/source/matplot/util/colors.cpp:10:1: note: « uint8_t » est défini dans l'en-tête «  » ; avez-vous oublié « #include  » ? 9 | #include +++ |+#include 10 | /tmp/matplotplusplus/source/matplot/util/colors.cpp:204:28: erreur: expected « ; » before « a1 » 204 | uint8_t a1 = static_cast( | ^~~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:209:28: erreur: expected « ; » before « a2 » 209 | uint8_t a2 = static_cast( | ^~~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:213:21: erreur: « a » n'a pas été déclaré dans cette portée 213 | a = (a1 << 4u) | a2; | ^ /tmp/matplotplusplus/source/matplot/util/colors.cpp:213:26: erreur: « a1 » n'a pas été déclaré dans cette portée; vouliez-vous employer « y1 » ? 213 | a = (a1 << 4u) | a2; | ^~ | y1 /tmp/matplotplusplus/source/matplot/util/colors.cpp:213:38: erreur: « a2 » n'a pas été déclaré dans cette portée 213 | a = (a1 << 4u) | a2; | ^~ /tmp/matplotplusplus/source/matplot/util/colors.cpp:215:24: erreur: expected « ; » before « r1 » 215 | uint8_t r1 = static_cast( | ^~~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:219:24: erreur: expected « ; » before « r2 » 219 | uint8_t r2 = static_cast( | ^~~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:223:24: erreur: expected « ; » before « r » 223 | uint8_t r = (r1 << 4u) | r2; | ^~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:224:24: erreur: expected « ; » before « g1 » 224 | uint8_t g1 = static_cast( | ^~~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:228:24: erreur: expected « ; » before « g2 » 228 | uint8_t g2 = static_cast( | ^~~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:232:24: erreur: expected « ; » before « g » 232 | uint8_t g = (g1 << 4u) | g2; | ^~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:233:24: erreur: expected « ; » before « b1 » 233 | uint8_t b1 = static_cast( | ^~~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:237:24: erreur: expected « ; » before « b2 » 237 | uint8_t b2 = static_cast( | ^~~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:241:24: erreur: expected « ; » before « b » 241 | uint8_t b = (b1 << 4u) | b2; | ^~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:242:48: erreur: « a » n'a pas été déclaré dans cette portée 242 | result[0] = static_cast(a) / 255; | ^ /tmp/matplotplusplus/source/matplot/util/colors.cpp:243:48: erreur: « r » n'a pas été déclaré dans cette portée 243 | result[1] = static_cast(r) / 255; | ^ /tmp/matplotplusplus/source/matplot/util/colors.cpp:244:48: erreur: « g » n'a pas été déclaré dans cette portée 244 | result[2] = static_cast(g) / 255; | ^ /tmp/matplotplusplus/source/matplot/util/colors.cpp:245:48: erreur: « b » n'a pas été déclaré dans cette portée 245 | result[3] = static_cast(b) / 255; | ^ /tmp/matplotplusplus/source/matplot/util/colors.cpp: Dans la fonction « std::string matplot::to_string(const std::array&) »: /tmp/matplotplusplus/source/matplot/util/colors.cpp:274:18: erreur: « uint8_t » n'a pas été déclaré dans cette portée 274 | auto a = uint8_t(c[0] * 255); | ^~~~~~~ /tmp/matplotplusplus/source/matplot/util/colors.cpp:274:18: note: « uint8_t » est défini dans l'en-tête «  » ; avez-vous oublié « #include  » ? /tmp/matplotplusplus/source/matplot/util/colors.cpp:278:16: erreur: expected « ; » before « mask » 278 | uint8_t mask = 0b00001111; | ^~~~~ | ; /tmp/matplotplusplus/source/matplot/util/colors.cpp:280:29: erreur: « mask » n'a pas été déclaré dans cette portée 280 | str[3] = digits[a & mask]; | ^~~~ gmake[2]: *** [source/matplot/CMakeFiles/matplot.dir/build.make:216: source/matplot/CMakeFiles/matplot.dir/util/colors.cpp.o] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:157: source/matplot/CMakeFiles/matplot.dir/all] Error 2 gmake: *** [Makefile:136: all] Error 2 ```

Platform

Environment Details:

Additional context