
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
What is the difference between g++ and gcc?
g++
GNU C++ Compiler ( g++ ) is a compiler in Linux which is used to compile C++ programs. It compiles both files with extension .c and .cpp as C++ files.
The following is the compiler command to compile C++ program.
g++ program.cpp -o filename
Here,
filename − The name of file with .c or .cpp extension.
The following is an example of using g++ compiler.
Example
#include <iostream> using namespace std; int main() { int a = 20; cout << "The value of a : " << a; return 0; }
Output
$g++ -o main *.cpp $main The value of a : 20
gcc
GNU C Compiler ( gcc ) is a compiler in Linux which is used to compile C programs. It compiles files with extension “.c”.
The following is the compiler command to compile C program.
gcc program.c -o filename
Here,
filename − The name of file with .c extension.
The following is an example of using gcc compiler.
Example
#include <stdio.h> int main() { int a = 20; printf("The value of a : %d", a); return 0; }
Output
$gcc -o main *.c $main The value of a : 20
- Related Articles
- What is difference between GCC and G++ Compilers?
- Write the difference between ‘$g$’ and ‘$G$’.
- What is the relationship between G and g in physics?
- What is Host, and what is the difference between Nutrients and Nutrition?
- What is the difference between Java and JavaScript?
- What is the difference between JavaScript and ECMAScript?
- What is the difference between JavaScript and C++?
- What is the difference between HTML tags and ?
- What is the difference between jQuery and JavaScript?
- What is the difference between jQuery.size() and jQuery.length?
- What is the difference between jQuery and AngularJS?
- What is the difference between jQuery.show() and jQuery.hide()?
- What is the difference between jQuery.animate() and jQuery.hide()?
- What is the difference between = and: = assignment operators?
- What is the difference between time.clock() and time.time()?

Advertisements