Sunday, December 30, 2012

cc.exe

A simple program that I wrote to ease the compilation process using GCC. It takes one string as the input file name and the output file is named as the input file.

For example, to make an EXE from the file Example.c, one must type in the command prompt:
gcc Example.c -o Example.exe

By using cc.exe, one must only type:
cc Example

Below is the source code:

#include <stdio.h>

int main(int argc, char *argv[]) {
    char a[100];
    sprintf(a, "gcc %s.c -o %s.exe", argv[1], argv[1]);
    system(a);
    return 0;
}