C++ Program Compilation

Compile your C++ program in Solaris

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

The command to compile your C++ program on Solaris is

CC program_name 
For example, if you compile hello.cpp this way:
CC hello.cpp -o hello
You would run the program, by typing

If you complile your C++ program using

CC hello.cpp 
To Run the program, type

Logon to Hercules from Solaris

If you want to change your UNIX account (Hercules) password, you have to logon to  Hercules, or if you want to work on Hercules instead of Solaris, you need to type command
ssh hercules

Compile your C++ program on Hercules

Once you are on Hercules, the command to compile your C++ program is  CC
Here is an example of compiling a program named hello.cpp, using

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

If you complile it using

CC hello.cpp 
then Run the program by typing

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.