C++ Program Compilation

Compile your C++ program on Hercules

If you don't have hello.cpp, you can click on this link hello.cpp and manage to get a copy for yourself.

Once you are on Hercules, the command to compile your C++ program is CAPITAL  CC

Here is an example of compiling a program named hello.cpp, using

CC hello.cpp -o hello 
to compile and then using
hello 
to run the program.

If you complile it using

CC hello.cpp 
then Run the program by typing
a.out

Summary
CC UNIX is case sensitive, capital CC is a C++ compiler command.
hello.cppYour C++ program name
-o hello The "-o" is used to create an executable file as specifiled by the name following -o. When you don't use "-o", the executable filename will be called a.out.


Copyright: Department of Computer Science, University of Regina.