How to fix Arduino error: 'size_t' has not been declared

Problem:

In Arduino, you see an error message like

src/main.cpp:7:48: error: 'size_t' has not been declared
void MyFunction(size_t size);

Solution

Include stddef.h where size_t is declared:

#include <stddef.h>

Add this line to the top of the file where the error occured.