Skip to content

Build fails on Fedora 43: 'uint64_t' not declared in string_util.h (missing <cstdint> include) #856

@ShelpAm

Description

@ShelpAm

Steps to reproduce the issue:

  1. cd to the root of the project.
  2. cmake -Bbuild -S.
  3. cmake --build build
  4. The compiler then reports:
In file included from /home/shelpam/Documents/projects/bustub/src/common/util/string_util.cpp:22:
/home/shelpam/Documents/projects/bustub/src/include/common/util/string_util.h:62:26: error: ‘uint64_t’ has not been declared
   62 |   static auto FormatSize(uint64_t bytes) -> std::string;
      |                          ^~~~~~~~
/home/shelpam/Documents/projects/bustub/src/include/common/util/string_util.h:1:1: note: ‘uint64_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
  +++ |+#include <cstdint>
    1 | //===----------------------------------------------------------------------===//
/home/shelpam/Documents/projects/bustub/src/common/util/string_util.cpp:137:6: error: no declaration matches ‘std::string bustub::StringUtil::FormatSize(uint64_t)’
  137 | auto StringUtil::FormatSize(uint64_t bytes) -> std::string {
      |      ^~~~~~~~~~
/home/shelpam/Documents/projects/bustub/src/include/common/util/string_util.h:62:15: note: candidate is: ‘static std::string bustub::StringUtil::FormatSize(int)’
   62 |   static auto FormatSize(uint64_t bytes) -> std::string;
      |               ^~~~~~~~~~
/home/shelpam/Documents/projects/bustub/src/include/common/util/string_util.h:23:7: note: ‘class bustub::StringUtil’ defined here
   23 | class StringUtil {

A probable solution may be adding #include <cstdint> to the front of src/include/common/util/string_util.h , as the compiler hinted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions