1

It is my understanding that the Windows operating system (Windows 7 to be exact) must come with a C compiler because the OS is written in C.

How can I access such a compiler to compile my C source code?

techraf
  • 4,902
  • 2
    It doesn't come with one. You'll have to download a suitable compiler. – Sathyajith Bhat Mar 07 '14 at 07:45
  • WHAAAT?? Then how does the C based OS work if it can't even compile its own code? – George Newton Mar 07 '14 at 07:47
  • 1
    er, you compile, build & ship the executable files. Much like how most closed source software is distributed. – Sathyajith Bhat Mar 07 '14 at 07:49
  • 1
    Windows doesn't come with its own code either. – jlliagre Mar 07 '14 at 07:49
  • 2
    What Sathya says is correct (at least for the versions of Windows I'm familiar with). Compiled code does not need a compiler to be present to execute. It is compiled before its put onto the disk and you only get the finished product which executes the, if you like, assembler code. – davidgo Mar 07 '14 at 07:49
  • Oh My, I've been thinking about it wrong all this time! Thank you all for this. – George Newton Mar 07 '14 at 07:55
  • Okay, if there isn't a C compiler, there must be an assembly code compiler, right? So what's the command for the x86 compiler? – George Newton Mar 07 '14 at 07:58
  • 3
    No, it doesn't need an assembler either. It's all precompiled machine code binaries. The actual numeric opcodes that are directly executed by the CPU. – Spiff Mar 07 '14 at 08:06

1 Answers1

8

Not necessarily - You'd just need the necessary libraries - like libc or mscrt if they are dynamically linked, or just suitable runtime support for the binaries you are running . Even many linux distributions do not come with compilers built in (I often end up installing build-essential for Ubuntu when I need to compile packages for example), so expecting windows to have one built in is not correct.

You can run compiled files without a compiler on the system. Its interpreted languages that often need the language tools installed to run - like Java or Python

If you must have a compiler, there's two fairly common options - the open source mingw or microsoft's visual studio - there's a free version called visual studio express. Install and configure one and carry one.

Journeyman Geek
  • 129,178