Programminging C++ on Solaris
CSE 230
Login to Solaris
- Double click the stdsun icon on Windows
desktop to bring up the Solaris login prompt
Open a Terminal Window
- Once you're logged onto the Solaris system, click the
Terminal icon as shown below
Open a Program Editor
- Type the following command on the terminal window and
press
Enter to execute it
% gvim example1.cc &
gvim is the name of the editor and
example1.cc is the name of the
program
At this point, type the Hello World! program into
the editor and then save the program
Press the Save button in the toolbar or
File → Save example1.cc
Compiling a Program
- Type the following command on the terminal window and
press
Enter to execute it
% g++ -o example1 example1.cc
g++ is the name of the compiler and
example1 is the name of the
executable
At this point, any compiler errors would be printed out in
the terminal window
You must go through the program code in the editor to find
these errors and correct them
Executing a Program
- Type the following command on the terminal window and
press
Enter to execute it
% ./example1
Upon execution, you should see the following printed out
in the terminal window
Hello World!