discord / gamesdk-and-dispatch

Public issue tracker for the Discord Game SDK and Dispatch
22 stars 7 forks source link

SDK fails to compile with GCC 11.1 due to missing include #144

Open RealFloorIsJava opened 2 years ago

RealFloorIsJava commented 2 years ago

This time in the correct tracker ;-)

Description

SDK cpp files fail to compile due to missing include in some environments.

Analysis below.

Steps to Reproduce

Attempt to compile the code.

Expected Behavior

SDK files compile

Current Behavior

In file included from /home/snip/snap/snip/src/plugins/discordpresence/discord/achievement_manager.h:3,
                 from /home/snip/snap/snip/src/plugins/discordpresence/discord/achievement_manager.cpp:5:
/home/snip/snap/snip/src/plugins/discordpresence/discord/types.h:167:23: error: ‘int64_t’ in namespace ‘std’ does not name a type
  167 | using ClientId = std::int64_t;

Screenshots/Videos

N/A

Client and System Information

Arch Linux w/ GCC 11.1. Latest SDK.

Analysis and fix

The sdk uses fixed width integer types (FWIT) from the std namespace but only includes stdint.h. In order to obtain the FWIT inside std, the standard compliant way is to include <cstdint>.

See https://en.cppreference.com/w/cpp/types/integer