Thursday, December 03, 2015

Compile C programs in Ubuntu Linux using GCC

If you would like to compile your first C program on an Ubuntu Linux, it might not work out of the box. Needless to say, I was disappointed.

Versions I have:
GCC gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
Ubuntu 14.04 

To solve this, all you need to do is install "build-essential"
sudo apt-get install build-essential

Then you should be able to compile your code using gcc, (for example):
gcc bruteforce1.c -o bruteforce1  -std=c99

And of course, you will run the executable created:
./bruteforce1

Seems simple now, but I wish some things should work out of the box.