Skip to content

fix Generic.cpp build error due to missing includes - #725

Merged
liuzicheng1987 merged 1 commit into
getml:mainfrom
gg-sr:fix-build
Sep 22, 2026
Merged

liuzicheng1987 merged 1 commit into
getml:mainfrom
gg-sr:fix-build

Conversation

@gg-sr

@gg-sr gg-sr commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

I'm not sure why it works for others, but not for me. Maybe different compilation flags, since I'm wrapping the library in Bazel and not using the provided CMakeLists.

@liuzicheng1987

Copy link
Copy Markdown
Collaborator

@gg-sr that is weird, because we have pipeline checks just for that. But thanks for the contribution!

@gg-sr

gg-sr commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Here is the error I was getting:

external/+http_archive+reflect-cpp/src/rfl/Generic.cpp:112:42: error: implicit instantiation of undefined template 'std::numeric_limits<int>'
  112 |     if (*ptr < static_cast<int64_t>(std::numeric_limits<int>::min()) ||
      |                                          ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/max_size_type.h:53:10: note: template is declared here
   53 |   struct numeric_limits;
      |          ^
external/+http_archive+reflect-cpp/src/rfl/Generic.cpp:113:42: error: implicit instantiation of undefined template 'std::numeric_limits<int>'
  113 |         *ptr > static_cast<int64_t>(std::numeric_limits<int>::max())) {
      |                                          ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/max_size_type.h:53:10: note: template is declared here
   53 |   struct numeric_limits;
      |          ^

Adding #include <limits> fixes it. I added the other includes for completeness.

I assume you (or one of your dependencies) sets a flag that implicitly includes needed std headers, or our flags forbid such implicit includes, or our toolchains have different transitive includes.

@liuzicheng1987
liuzicheng1987 merged commit 8a3c3dc into getml:main Sep 22, 2026
176 checks passed
@gg-sr
gg-sr deleted the fix-build branch September 22, 2026 23:24
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