20

I have installed GCC with apt-get.

How can I check that it is installed correctly and which version?

Flyk
  • 1,480
Promy
  • 203
  • #include <stdio.h> int main() { printf("Hello, world!\n"); return 0; } Then, open a terminal and change directory to where you created the file, and run this: gcc test.c -o test ./test –  Apr 11 '14 at 05:44

3 Answers3

33

Just type on the commandline:

gcc -v

(give you both version and programs invoked by this compiler)

gcc --version 

(give you the gcc version)

muru
  • 197,895
  • 55
  • 485
  • 740
don.joey
  • 28,662
15

Or you can also create a Hello World to see if it links and compiles properly. Create a file named test.c with the following in it:

#include <stdio.h>

int main() {
    printf("Hello, world!\n");
    return 0;
}

Then, open a terminal and change directory to where you created the file, and run this:

gcc test.c -o test
./test

If it prints Hello, world! on the terminal, it's properly installed and ready to compile.

muru
  • 197,895
  • 55
  • 485
  • 740
3
which gcc

will enable you to know whether gcc is installed in your /usr/bin folder or not

Xen2050
  • 8,705
Ram
  • 31
  • 1