# How to check if Gnu C compiler is Installed upon my FreeBSD



## rikotech (Jul 7, 2014)

Hello everyone.
Can you tell me how to verify my FreeBSD for installed GCC?
Thank you.


----------



## SirDice (Jul 7, 2014)

*Re: How to check if Gnu C compiler is Installed upon my Free*



			
				rikotech said:
			
		

> Can you tell me how to verify my FreeBSD for installed GCC?


`gcc -v`


----------



## rikotech (Jul 8, 2014)

*Re: How to check if Gnu C compiler is Installed upon my Free*



			
				SirDice said:
			
		

> rikotech said:
> 
> 
> 
> ...


Thank you! 
I think the GCC had been installed during the FreeBSD installation. 
I got this output:
gcc version 4.2.1 20070719 [FreeBSD]

Now how to execute the GCC?


----------



## obsigna (Jul 8, 2014)

*Re: How to check if Gnu C compiler is Installed upon my Free*



			
				rikotech said:
			
		

> SirDice said:
> 
> 
> 
> ...



For executing a compiler, it would be good to have a source file to be compiled. Therefore, save the following classical example into a file named ~/hello.c:

```
#include <stdio.h>

int main(int argc, const char *argv[])
{
   printf("Hello, World!\n");
   return 0;
}
```


change to your home directory: `cd`
execute the C compiler within the GNU Compiler Collection in order to compile hello.c: `gcc hello.c -o hello`
run the compiled executable hello: `./hello`:

```
Hello, World!
```


----------



## SirDice (Jul 9, 2014)

*Re: How to check if Gnu C compiler is Installed upon my Free*



			
				rikotech said:
			
		

> I think the GCC had been installed during the FreeBSD installation.
> I got this output:
> gcc version 4.2.1 20070719 [FreeBSD]


Looking at the version of GCC you have a pre-10.0 installation. GCC was part of the base OS before 10.0.



> Now how to execute the GCC?


You already did.


----------

