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

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
 
Re: How to check if Gnu C compiler is Installed upon my Free

SirDice said:
rikotech said:
Can you tell me how to verify my FreeBSD for installed GCC?
gcc -v
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?
 
Re: How to check if Gnu C compiler is Installed upon my Free

rikotech said:
SirDice said:
rikotech said:
Can you tell me how to verify my FreeBSD for installed GCC?
gcc -v
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?

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:
Code:
#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:
    Code:
    Hello, World!
 
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.
 
Back
Top