Include only
#include <editline/readline.h>
which should exist if the command line tools are installed. This file contains the
“readline wrapper” for libedit, including the history functions as well.
An include file <editline/history.h>
does not exist on OS X.
I tested your code with that modification, and it compiled and ran without problems.