Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8415813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:33:20+00:00 2026-06-10T01:33:20+00:00

I want to compile a c file in OSX mountain lion. In Xcode 4.4,

  • 0

I want to compile a c file in OSX mountain lion. In Xcode 4.4, Preferences -> Downloads I can install command line tools to do that. However on that pane it advises me that I can use xcrun instead:

Before installing, note that from within Terminal you can use the XCRUN tool to launch compilers and other tools embedded within the Xcode application. Use the XCODE-SELECT tool to define which version of Xcode is active. Type “man xcrun” from within Terminal to find out more.

I’d be happy to do it that way, but I’m having trouble getting it to find stdio.h.

$ xcrun gcc hello.c
hello.c:1:19: error: stdio.h: No such file or directory

I definitely have this file on my system after a standard install of Xcode via the App Store:
/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/stdio.h

I tried specifying the SDK but got the same error:

$ xcrun -sdk /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk gcc hello.c

Some googling led me to try running xcode-select before the commands above, but no luck. I only have the one version of Xcode installed anyway.

$ sudo xcode-select -switch /Applications/Xcode.app

How can I get it to find the headers?

Ultimately I gave up and installed command line tools, but it would be nice to know how to do it with the built-in Xcode tools.

Note: here is the file I was trying to compile:

#include <stdio.h>

int main() {
    printf("hello world!\n");
    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:33:22+00:00Added an answer on June 10, 2026 at 1:33 am

    You will have to specify the non-standard sysroot for the compiler.

    Using clang/llvm (which is the new standard) this would do the trick:

    xcrun clang --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/ -o hello hello.c 
    

    If you want to stick with gcc just replace “clang” with “gcc”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to compile a tiny actionscript file. Is there something out there that
If I want to compile a c source file that uses libxml, how do
We can compile coffescript file to js-file with command: coffee --join path/to/result.js --compile path/to/coffeescript_dir/
I want to compile a batch file into an EXE file using C++. I
I'm new to C programming. I want to compile C program using Make file.
File file = new File(file-type-string-i-want-2000-01-01-01-01-01.conf.gz); Matcher matcher = pattern.compile(\\-(.*)\\-\\d{4})).matcher(fileName); StringBuilder sb = new StringBuilder();
I want to compile my .java's (several) into one .jar that are compatible with
I am trying to compile a small .c file that has the following includes:
I want to compile / install the IP2Location Python extension found here: www.ip2location.com/python.aspx I
I have a txt file that I want to sort of 'grep' through and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.