Don't cast thread_self() to int. Cast to uintptr_t. Pull in the predefined printf format from <inttypes.h>