CentOS/RHEL 7.x Install GCC (C & C++) and Development Tools

Setup a basic development environment on a CentOS Enterprise Linux or Red Hat Enterprise Linux version 7.x

Check development Enviroment

yum group list

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.advancedhosters.com
 * extras: mirrors.advancedhosters.com
 * updates: mirrors.advancedhosters.com
Available environment groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   File and Print Server
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Available Groups:
   Compatibility Libraries
   Console Internet Tools
   Development Tools
   Graphical Administration Tools
   Legacy UNIX Compatibility
   Scientific Support
   Security Tools
   Smart Card Support
   System Administration Tools
   System Management
Done

install development tools

  • Type the following [nixcmd name=“yum” as root user:

yum group install “Development Tools”

  • OR Type the following [sudo as user]

$ sudo yum group install “Development Tools”

Verify your gcc installation

whereis gcc

gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz

gcc --version

gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

test hello.c

  • create hello.c using your favorite Editor like vim, emacs…
#include<stdio.h>
int main(void){
	printf("Hello World!\n");
	return 0;
}

cc hello.c -o hello ./hello

Hello World!