Skip to content

Commit 1a5bba5

Browse files
authored
Include cstdlib. (#1218)
nanobind uses std::abs, which is either defined in cstdlib or cmath. We must include one or the other. Fixes a build failure in our build environment: ``` In file included from third_party/benchmark/bindings/python/google_benchmark/benchmark.cc:6: ./third_party/nanobind/include/nanobind/operators.h:135:45: error: no member named 'abs' in namespace 'std'; did you mean simply 'abs'? 135 | NB_UNARY_OPERATOR(abs, abs, std::abs(l)) | ^ ~~~ .../llvm_unstable/src/libcxx/include/math.h:456:20: note: 'abs' declared here 456 | using std::__math::abs; | ```
1 parent dc35d69 commit 1a5bba5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

include/nanobind/nanobind.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
// Core C++ headers that nanobind depends on
3030
#include <cstddef>
3131
#include <cstdint>
32+
#include <cstdlib>
3233
#include <exception>
3334
#include <stdexcept>
3435
#include <type_traits>

0 commit comments

Comments
 (0)