← All tasks
cppalandefreitas/matplotplusplus #165Not a task: already works

Adding Matplot++ to CMakeLists.txt Breaks Project's C++20 Compilation

envgap__alandefreitas__matplotplusplus-165

01 / FAILURE SIGNATURE

As reported upstream

/home/xander/dev/my_model/src/MyClass.cpp:54:28: error: ‘class std::unordered_set<long int>’ has no member named ‘contains’
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
26cfa754457eecb815689dec53b4d8a409152a3a
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

alandefreitas/matplotplusplus #165 · read the original issue
**Bug category**

<!-- Mark the bug category with an x-->

- [x] *bug - compilation error*



**Describe the bug**

Adding Matplot++ to my project with `find_package(Matplot++ CONFIG REQUIRED)` break C++20 compiler functionality. 



**Steps to Reproduce**



```bash

wget https://github.com/alandefreitas/matplotplusplus/archive/refs/tags/v1.1.0.zip

unzip v1.1.0.zip

cd matplotplusplus-1.1.0

mkdir build

cd build

cmake ..

make -j 12

make install

```



Add to my project's CMakeLists.txt:

```

set(CMAKE_CXX_STANDARD 20)

find_package(Matplot++ CONFIG REQUIRED)

```



Now attempt to compile some code that makes use of a C++20-only feature, such as calling `contains` on a `std::set`. Compilation fails with:

```

/home/xander/dev/my_model/src/MyClass.cpp: In member function ‘void ccplutus::MyClass::read_batch(const std::shared_ptr<arrow::RecordBatch>&)’:

/home/xander/dev/my_model/src/MyClass.cpp:54:28: error: ‘class std::unordered_set<long int>’ has no member named ‘contains’

   54 |         if (!this->items.contains(market)) {

      |                            ^~~~~~~~

```



This is particularly perplexing  because this is not Matplot++ code that is failing to compile (it's already been compiled), this is my own code that is failing to compile simply because a `find_package` was added to my CMakeLists.txt. Commenting out the `find_package(Matplot++...)` trivially fixes the build.



**Platform**

<!-- Mark your platform with an x-->

- [x] *cross-platform issue - linux*



**Environment Details:**

 - OS: Ubuntu

 - OS Version: 18.04

 - Compiler: GCC

 - Compiler version: 10.3.0
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]