-
GCC compile c program
I know there is tons of posts on this but I still cant seem to solve my problem. I am brand new to programming and im trying to run my test.c in GCC.
my version is
Charles-Aweidas-MacBook-Pro:~ charlesaweida$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
Copyright (C) 2007 Free Software Foundation, Inc.
I am running the file off my desktop
Code:
#include <stdio.h>
int main(void){
printf("hello world\n");
return 0;
}
when i compile it I get a large 'blank space' and thats it.
Charles-Aweidas-MacBook-Pro:~ charlesaweida$ gcc /Users/charlesaweida/Desktop/test.c
Charles-Aweidas-MacBook-Pro:~ charlesaweida$
can anyone help me get up and running?
i installed Xcode, the comand line tool compiles just fine but i cant get it to compile in the terminal, i wonder if it cant find stdio.h???
hmmmmm
-
-
-
Can you explain "blank space" meaning. The command you showed for compilation is returning the prompt as expected. Kindly explain your problem more !
-
The compiler doesn't give me errors, but it does print "hello world"
-
Your test.c compiled successfully, without any errors. There should be a file in /Users/charlesaweida/Desktop named a.out. This is your program, and it should print "hello world" like it's supposed to. Nothing to worry about :)
-
try to compile your code with this sintax:
Code:
root@invecta:~# gcc -o test test.c
if no error message shows, thats mean you successfully to compile that code. To run your result, try to type ./test