I’m a novice programmer and have been experimenting with Javascript, jQuery and PHP but felt I wasn’t getting a real depth of understanding of what I was doing. So, after reading Joel Spolsky’s response to a question on this site (which I can’t find now!), I took it back to basics and read Charles Petzold’s ‘Code’ and am about to move onto Kernighan and Richie’s The C Programming Language. I want to learn this in a UNIX environment but only have access to a Windows system. I have Ubuntu 12.04 running on a virtualised machine via VMWare Player, and done some coding in the terminal.
Is using a Linux distro the only option for programming in a UNIX environment on Windows? And what are the next steps to start programming in C in UNIX and where do I get a compiler from?
1
Linux in VM is the easiest option to learn UNIX. If you’re running Ubuntu, you can open up terminal and type:
sudo apt-get install gcc
And you’ll have your compiler. Debian-based distros in general will make development very easy because if you’re missing library X, chances are it’s already in the repositories and you can apt-get it with minimum fuss.
For the other part of your question: no, Linux in VM is not the only way to go, but it’s the easiest to get started with. You can always intall FreeBSD / Open Solaris / etc but I don’t recommend those for your first plunge.
Finally, if you want to force yourself to learn the system, you can install it on bare metal and ditch the VM. I recommend dual-booting to start. You will probably start running into driver / configuration problems 🙂 and ultimately have to learn how everything works.
Good luck.
EDIT
In reference to some comments: MinGW and Cygwin will not help the OP learn UNIX/POSIX. The OP clearly stated that she/he is interested in C programming in UNIX, and that means UNIX-specific APIs, patterns, and issues.
4
If you really don’t want to move to Linux, or continue using Linux on a virtual machine, you could give Cygwin a try. It’s:
a collection of tools which provide a Linux look and feel environment for Windows.
a DLL (cygwin1.dll) which acts as a Linux API layer providing substantial Linux API functionality.
More importantly, it makes The GNU Compiler Collection available on Windows. A similar tool, but a bit more tuned for developers is MinGW. It includes:
- A port of the GNU Compiler Collection (GCC), including C, C++, ADA and Fortran compilers;
- GNU Binutils for Windows (assembler, linker, archive manager)
- A command-line installer (mingw-get) for MinGW and MSYS deployment on MS-Windows
- A GUI wrapper (mingw-get-inst) for the command line installer
Everything you need, and then some.
4
OSX since 10.5 and forward is offically considered a Unix. Solaris is another option. Either one can be installed on Virtual Box, both include GCC as a compiler. Ignore cygwin under Windows, it is more trouble than it is worth, and isn’t a full Unix environment/experience.
I use Virtual Box on both an OSX machine and a Windows machine to host Linux ( CentOS ) and with a dual monitor setup and plenty of RAM you don’t even realize that it is not a real machine you are using.
1