Skip to content

[BUG] Missing <cstdint> include in ann_exception.h causes uint32_t compilation error #673

@gptabhinav

Description

@gptabhinav

Expected Behavior

DiskANN should compile successfully without modification on a standard Linux environment.

Actual Behavior

Build fails when compiling ann_exception.cpp because uint32_t is not declared in include/ann_exception.h.

Example Code

git clone https://github.com/microsoft/DiskANN.git
cd DiskANN
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)

Dataset Description

Not applicable here

Error

In file included from src/ann_exception.cpp:4:
include/ann_exception.h:22:65: error: ‘uint32_t’ has not been declared
   22 |                                    const std::string &fileName, uint32_t lineNum);
      |                                                                 ^~~~~~~~
compilation terminated due to -Wfatal-errors.
make[2]: *** [src/CMakeFiles/diskann.dir/build.make:93: src/CMakeFiles/diskann.dir/ann_exception.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:314: src/CMakeFiles/diskann.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

Your Environment

*Operating system: Ubuntu 22.04 (Pop!_OS derivative)

  • Compiler: g++ 11.4
  • CMake: 3.22
  • DiskANN version: commit 1f08328

##Suggested Fix
Add the missing include at the top of include/ann_exception.h:

#include <string>
#include <cstdint>   // add this line

Optionally update the function signature to use std::uint32_t for portability.

Additional Details

The root cause is that include/ann_exception.h uses uint32_t but does not include or <stdint.h>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions