That is--can I program in C without any OS? If the answer is "Yes",how can a C compiler be "Installed" at this kind of situation?
thanx in advance!

A C compiler requires certain things to run (e.g. access to files, memory, etc). Those things are normally provided by an OS. In theory, it may be possible to port a C compiler to run on "bare metal", but to do that you'd end up implementing things like file systems, disk device drivers, etc, and would end up with a limited OS that happens to compile things.dashllh wrote:That is--can I program in C without any OS? If the answer is "Yes",how can a C compiler be "Installed" at this kind of situation?
Thank you very much for reply ,sortie.sortie wrote:You forgot to read the forum rules!
This is not a weird question, as much as an obviously already answered question. You certainly can write C programs that work without any operating system. That is what a kernel written in C is. That's what this website is about. As for how, you can spot the link
The OSDev.org Wiki - Got a question? Search this first!
above. This should be sufficient answer when combined with the forum rules.
Thank you very much for providing me useful detailed knowledgeBrendan wrote:Hi,
A C compiler requires certain things to run (e.g. access to files, memory, etc). Those things are normally provided by an OS. In theory, it may be possible to port a C compiler to run on "bare metal", but to do that you'd end up implementing things like file systems, disk device drivers, etc, and would end up with a limited OS that happens to compile things.dashllh wrote:That is--can I program in C without any OS? If the answer is "Yes",how can a C compiler be "Installed" at this kind of situation?
Also, you can't program with a compiler alone. You'd need some way to read compiler errors (virtual terminal, shell?), a way to edit source files, a linker, misc. utilities (e.g. to create/delete directories), etc.
Cheers,
Brendan
That depends on how you define "compiler" and "OS".dashllh wrote:Thank you very much for providing me useful detailed knowledge![]()
I guess what you mean is -- a compiler have to work together with an OS(at least a limited one),am i right?