Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add #include <stdexcept> #32

Merged
merged 1 commit into from
Apr 23, 2024
Merged

Add #include <stdexcept> #32

merged 1 commit into from
Apr 23, 2024

Conversation

iiisak
Copy link
Contributor

@iiisak iiisak commented Apr 10, 2024

The lack of this include was causing a compilation error

@vpetrigo
Copy link
Owner

Hello @iiisak,

Would you provide a minimum example when the error you mentioned occurs? There is a pipeline setup for various compilers and there were no errors without that header included.

@iiisak
Copy link
Contributor Author

iiisak commented Apr 11, 2024

Hey! Sure, here's the compilation error.

.../caches/include/cache.hpp: In constructor ‘caches::fixed_sized_cache<Key, Value, Policy, HashMap>::fixed_sized_cache(size_t, Policy<Key>, on_erase_cb)’:
.../caches/include/cache.hpp:52:24: error: ‘invalid_argument’ is not a member of ‘std’
   52 |             throw std::invalid_argument{"Size of the cache should be non-zero"};
      |                        ^~~~~~~~~~~~~~~~
.../caches/include/cache.hpp:16:1: note: ‘std::invalid_argument’ is defined in header ‘<stdexcept>’; did you forget to ‘#include <stdexcept>’?
   16 | #include <unordered_map>
  +++ |+#include <stdexcept>
.../caches/include/cache.hpp: In member function ‘const Value& caches::fixed_sized_cache<Key, Value, Policy, HashMap>::Get(const Key&) const’:
.../caches/include/cache.hpp:123:24: error: ‘range_error’ is not a member of ‘std’
  123 |             throw std::range_error{"No such element in the cache"};
      |                        ^~~~~~~~~~~
.../caches/include/cache.hpp:123:24: note: ‘std::range_error’ is defined in header ‘<stdexcept>’; did you forget to ‘#include <stdexcept>’?

I believe this part of my CMakeLists.txt might be relevant as well:

set(CMAKE_C_COMPILER arm-none-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-none-linux-gnueabihf-g++)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "arm")

@vpetrigo vpetrigo merged commit 8973d09 into vpetrigo:master Apr 23, 2024
22 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants