Hi everyone,
I am trying to compile some C code from the terminal, and I am running into trouble. I have installed Xcode, so I have the GCC compiler, but Xcode installs it into /developer/usr/bin. So I used
export PATH=$PATH:/developer/usr/bin
which worked. It found the GCC compiler. Then I had to tell it where my libraries were...so I used
export LIBRARY_PATH=$LIBRARY_PATH:/Developer/SDKs/MacOSX10.6.sdk/usr/lib
which also worked. But then, if I want to use any header files with #include, it doesn't know where to find them, and I don't know how to tell it where they are.
I am trying to compile the infamous "hello world" program:
#include <stdio.h>
int main(void)
{
printf("Hello World");
getch();
}
but I don't know where it is looking for the stdio.h file.
It seems like all of this could be prevented if Xcode would just install GCC into the usr/local/bin folder, which is where I think it should be.
Can anyone tell me how to make this happen? Or do I need to reinstall OS X and specify that I want GCC etc. installed?
Thank you.
I am trying to compile some C code from the terminal, and I am running into trouble. I have installed Xcode, so I have the GCC compiler, but Xcode installs it into /developer/usr/bin. So I used
export PATH=$PATH:/developer/usr/bin
which worked. It found the GCC compiler. Then I had to tell it where my libraries were...so I used
export LIBRARY_PATH=$LIBRARY_PATH:/Developer/SDKs/MacOSX10.6.sdk/usr/lib
which also worked. But then, if I want to use any header files with #include, it doesn't know where to find them, and I don't know how to tell it where they are.
I am trying to compile the infamous "hello world" program:
#include <stdio.h>
int main(void)
{
printf("Hello World");
getch();
}
but I don't know where it is looking for the stdio.h file.
It seems like all of this could be prevented if Xcode would just install GCC into the usr/local/bin folder, which is where I think it should be.
Can anyone tell me how to make this happen? Or do I need to reinstall OS X and specify that I want GCC etc. installed?
Thank you.