Skip to content

include <sys/types.h> where uint is used

Jakub Jirůtka requested to merge (removed):fix-sys-types into master

Compilation fails on gcc 6.3.0 and musl libc:

g++ -pipe -std=c++11 -O3 -DNDEBUG -DRELEASE -c -Wall -pedantic -Wextra -Werror \
  -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor \
  -Wredundant-decls -fPIC \
  ... \
  alib2algo_experimental/src/graph/spanningtree/Kruskal.cpp \
  -o alib2algo_experimental/obj-release/graph/spanningtree/Kruskal.o
In file included from alib2algo_experimental/src/graph/spanningtree/Kruskal.cpp:15:0:
alib2algo_experimental/src/graph/spanningtree/../datastructs/Components.h:74:3: error: 'uint' does not name a type
   uint parent;
   ^~~~

This type is defined in sys/types.h when _GNU_SOURCE or _BSD_SOURCE is defined (at least in musl libc). Please note that uint is not specified in C++ standard and should not be used...

Merge request reports