How to compile and run C++ programs in UNIX environment?

:frowning: :confused: Does anybody here know how to compile and run C++ programs in UNIX enviroment? I am so confused. Any help on this would be greatly appreciated! Thanks!

-> To compile after saving and exiting the program(ESC :wq)
at command prompt the command is CC <filename>
(Your filename needs to have an extension .C)

->To run the program at command prompt you need to type
./a.out.

->To compile and run without closing your program
it is (ESC) :!CC % and (ESC) :!./a.out

If your c file is myfile.c, then

gcc -o myfile myfile.c

will produce an executable file called 'myfile'

in c++ for unix the syntax should be under g++ not gcc. the file name ended is not similar then gcc where is the file name end with *.cpp. Also as this thread is been posted twice the explanation can be found in this post.

:frowning: I am using the school's UNIX system and none of those commands, like "gcc", "CC", "g++", work. Cry...
But I have Borland C++5.5. Do I have to set path like in Java? I could not make it work either. Guess I am just being dum. wuwu...

what is the Unix OS on that system. If it does not contains gcc or g++ on it , i suggest you could report to the Sys admin of the system to get it install. Else its quite difficult to run g++ on it. ( Just a suggestion)