Include -g flag for both compilation and linking so that the debugging information is correctly generated.