DanielChappuis / reactphysics3d

Open source C++ physics engine library in 3D

Home Page:http://www.reactphysics3d.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build failing - Missing include in configuration.h

JoeRosselli opened this issue · comments

Hi,

The Problem

The project fails to build for me on Ubuntu 23.10 using GCC 13.2.0 and CMake 3.27.4.

I'm doing a basic git check out, cmake, then make flow.

Sample error message:

/{redacted}/reactphysics3d/include/reactphysics3d/configuration.h:69:19: error: ‘int8_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?

When attempting to build it outputs hundreds/thousands of errors related to this.

The Cause/Fix

The root problem seems to be because configuration.h references various standard library type definitions (std::int8_t, std::uint8_t, etc.,) but doesn't include the header they're defined in.

All of those type definitions are defined in cstdint, and so configuration.h should be modified to include this header (https://en.cppreference.com/w/cpp/header/cstdint)

I tested locally modifying the header to include cstdint with the other system headers and all errors went away and the project built successfully without issue.

Here are the problematic lines:

using int8 = std::int8_t;
using uint8 = std::uint8_t;
using int16 = std::int16_t;
using uint16 = std::uint16_t;
using int32 = std::int32_t;
using uint32 = std::uint32_t;
using int64 = std::int64_t;
using uint64 = std::uint64_t;

Thanks!

I should probably also note that I'm building with cxx_std_23 compiler feature enabled.

The build failure is likely a combination of compiler + c++ version, where the latest c++ standard/compiler no longer erroneously exposes the type definitions from other system headers and now cstdint is required to be included.

Thanks for reporting this issue. This has been fixed and merged into the 'develop' branch in the this pull request. This fix will be available in the next release of the library.

This is now fixed in version v0.10.0 of the library. Thanks a lot for reporting the issue.