The command used to compile is malformed. Library linking options need to go after outputs and inputs. This works:
$ LC_ALL=C g++ -Wall -o sample1 quantlib-sample-1.cpp -lQuantLib
With '-lQuantLib' at the end of the command.
It works both including 'ql/quantlib.hpp' or 'ql/time/all.hpp'.