For Debian systems like Ubuntu run this command from the command line:
$ sudo apt-get install build-essential
For RPM based Linux like Fedora, RedHat, or CentOS 7:
$ sudo yum groupinstall development-tools
$ cc --version
Download latest XCode fro Apple or install DVD
You can also use VirtualBox and have a Linux installation and follow instructions in this tutorial
You can use Cygwin or MinGW to have standard Unix software development tools
You can also use VirtualBox and have a Linux installation and follow instructions in this tutorial (recommended)
VirtualBox allows you to run an entire operating system inside another operating system. We can run Ubuntu in host Windows/Mac using VirtualBox.
Run this command from the command line:
$ sudo apt-get install build-essential
Once installed you should be able to type:
$ cc --version
In terminal run this command:
$ sudo apt install vim
Once installed you should be able launch vim:
$ vim
Press 'i' to start insert mode and edit:
Follow Vim tutorials to learn shortcut keys
#include
/* This is a comment. */
int main(int argc, char *argv[])
{
// this is another comment
printf("Hello World");
return 0;
}
In terminal run this command in the same directory where you wrote the program:
$ make hello
Now run:
$ ./hello
In terminal run this command in the same directory where you wrote the program:
$ gcc hello.c
The compiler might show its messages (errors, warnings, etc.) differently, but in all cases, you'll get a file "a.out" as a result, if the compilation completed successfully. If you want the resulting program to be called "hello"
$ gcc -o hello hello.c
The '-o' flag simply name the resulting executable file as specified.
Once compiled and linked the program, run it by simply typing its name:
$ ./hello
By putting './' in front of the file name, we explicitly tell our Unix shell that we want to run the program from the current directory.