LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to compile and execute c and c++ programs in linux (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-compile-and-execute-c-and-c-programs-in-linux-407246/)

sathish80 01-24-2006 01:16 AM

How to compile and execute c and c++ programs in linux
 
Hai
How to compile and execute c and c++ programs in linux

Nylex 01-24-2006 01:44 AM

You compile C programs with gcc:

$ gcc program.c

For C++ programs:

$ g++ program.cc

The executables are usually named a.out, so you run them with

$ ./a.out

You can change the name of the executable with the -o option:

$ g++ test.cc -otest

This will give you an executable named test, which you can run in the same way as above. Read the man pages for gcc and g++ for more options you can use with them.


All times are GMT -5. The time now is 03:03 AM.