“unknown type name ‘size_t'” error from included .cpp file, but removed when included file name changed to .h file. Why? [closed]

#include <stddef.h> for size_t (C)

#include <cstddef> for std::size_t (C++)

cstddef also defines size_t in the global namespace, although it is not guaranteed by the C++ standard.

Leave a Comment