Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Installing GCC compiler to usr/local/bin
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="KBG" data-source="post: 1235085" data-attributes="member: 201493"><p>Hi everyone,</p><p></p><p>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 </p><p></p><p>export PATH=$PATH:/developer/usr/bin</p><p></p><p>which worked. It found the GCC compiler. Then I had to tell it where my libraries were...so I used</p><p></p><p>export LIBRARY_PATH=$LIBRARY_PATH:/Developer/SDKs/MacOSX10.6.sdk/usr/lib</p><p></p><p>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. </p><p></p><p>I am trying to compile the infamous "hello world" program:</p><p></p><p>#include <stdio.h></p><p></p><p>int main(void)</p><p>{</p><p> printf("Hello World");</p><p></p><p>getch();</p><p>}</p><p></p><p></p><p> but I don't know where it is looking for the stdio.h file.</p><p></p><p></p><p>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.</p><p></p><p>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?</p><p></p><p>Thank you.</p></blockquote><p></p>
[QUOTE="KBG, post: 1235085, member: 201493"] 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. [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Installing GCC compiler to usr/local/bin
Top