Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is my "stdio.h" in Mac?

Tags:

c

macos

I know that Mac OS X is a Unix-based system. And I heard that C standard library such as stdio.h, is located in /usr/local/include or /usr/include. But there is not any kind of library in this directory. I use Terminal to search this directory and I also use command like find ./ -iname "stdio.h", but nothing comes out. However, strangely enough, gcc -test.c -o test command works out. How did it happen? I want to know where my C library is located. p.s I also use Xcode, too. Is it related with this application? help me! And I have AWS EC2 linux server, and it has both libraries that i refereed above.

like image 802
user3595632 Avatar asked Feb 06 '15 09:02

user3595632


People also ask

Where are C header files on Mac?

From there, usr/include holds common public headers such as the standard C headers, and various Apple headers are in frameworks under System . In /Applications/Xcode. app/Contents/Developer/Platforms , you will likely find folders for other platforms, such as iPhoneOS. platform and AppleTVOS.

How do I fix Stdio h file not found?

Assuming C h> is one of the standard C headers. Your compiler complains that it can not find this header. This means that your standard library is broken. Consider reinstalling your compiler.

What is #include Stdio H directory?

h> You tell the compiler to search for the file 'stdio. h' in the standard library folders only . but when you write #include”stdio. h” You mean that search the file 'stdio. h' in the standard library functions as well as in the current folder where you are working .

Where is the Stdio h file located in Windows?

The library is in whichever one of the C Runtime Libraries against which you are linking. Those libraries are in the VC\lib folder in the Visual Studio installation directory. Thanks for your answer.


2 Answers

If you have Xcode but have not installed the optional Command Line Tools package then the standard includes and libraries may not be found in the usual place. Try:

$ find /Applications/Xcode.app -name stdio.h 

and you'll probably see something like:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/c++/4.2.1/tr1/stdio.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/stdio.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sys/stdio.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/c++/4.2.1/tr1/stdio.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/stdio.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sys/stdio.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/stdio.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1/tr1/stdio.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/stdio.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/stdio.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/tr1/stdio.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/stdio.h 

However you might want to install the Command Line Tools package if you plan on doing any non-Xcode (i.e. command line) programming. You will then see the usual headers and libraries in /usr/include and /usr/lib.

like image 133
Paul R Avatar answered Sep 30 '22 16:09

Paul R


If you don't have Command Line Tools installed you can run:

xcode-select --install 

A dialogue box opens for you to accept the license agreement and so on.

(This was missing from the above responses.)

like image 38
polarise Avatar answered Sep 30 '22 16:09

polarise