When you compile with -c, it generates an object (.o) file, not an executable. You need to compile it without -c in order to make an executable file.
Larger C++ programs will have more than one .cpp file; for each .cpp file, you would compile using -c to generate their respective .o file. Then you would link these .o files (running g++ without -c) to generate the final executable.
Asked in February 2016Viewed 2,963 timesVoted 5Answered 1 times