jump to navigation

How to compile C/C++ using GNU compiler in Linux July 25, 2009

Posted by viboon in : C, Ubuntu , add a comment

To display the installed GNU compiler version

$ gcc -v

Compile the code

$ gcc test.c

Using this command the compiler will make an output file named “a.out”. In order to change it to the different name, an additional argument has to be added.

$ gcc -o outputoftest test.c

To run the compiled program when the current directory is not included in the environmental variable.

$ ./outputoftest

Tags: , , , , ,

Related posts: