Question:
How do you compile a program in c using Unix?
Ellie
2008-08-24 11:05:11 UTC
I've done a lot of Java programming on Unix, but I'm having difficulty figuring out how to compile a C program. I have Mac OS X and am using Unix. I am just trying to write a very basic "hello world" type program, so I did "emacs hello.c", typed a few lines for the program, saved, and then tried to compile using "cc hello.c" or gcc hello.c". The result was "-bash: gcc: command not found".

Do I have to download something in order to be able to compile, or is there something else I should try? Thanks in advance for any help.
Three answers:
mcworld
2008-08-24 11:17:16 UTC
sound like you don't have the gcc compiler installed. Follow the instructions for installing on your version of unix.



usually a "command not found" error indicates the program your trying to execute is either not installed or is not in your working directory. in this case I would say its not installed.
suitti
2008-08-24 13:31:58 UTC
You should be able to get gcc for your machine. As you don't have a C compiler, you'll need a binary distribution.
Moose
2008-08-24 11:18:33 UTC
if you don't have gcc installed, you can't use gcc, obviously.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...