add -lm (..DSO..)
use %zu instead of %lu to print size_t (less compiler warnings). better text messages. typo