Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

stdio.h?

In many of the first programs I see in C, such as the basic Hello World program, there is a header file for stdio.h. But when I try compiling it in the terminal, it can't find it. It also can't find "printf". I have already installed the DeveloperTools.pkg. Am I missing something?

MacBook, Mac OS X (10.4.10)

Posted on Sep 20, 2007 2:38 PM

Reply
Question marked as Best reply

Posted on Sep 20, 2007 3:49 PM

First of all, if it can't find stdio.h it surely won't be able to find printf() becaus eit is defined inside stdio.h.
Second of all, check this carefully... Did you wrote :


#include <stdio.h>


Or...


#include "stdio.h"


The first one is good, the second is not. When you put #include <filename> with the chevrons, it means that the compiler has to search in the standard include folders. Whereas when you write : #include "filename" with the double quote, it means that the compiler has to look for the file in the same folder as the file is compiling. That's why you need to watch out.
7 replies
Question marked as Best reply

Sep 20, 2007 3:49 PM in response to Computr821

First of all, if it can't find stdio.h it surely won't be able to find printf() becaus eit is defined inside stdio.h.
Second of all, check this carefully... Did you wrote :


#include <stdio.h>


Or...


#include "stdio.h"


The first one is good, the second is not. When you put #include <filename> with the chevrons, it means that the compiler has to search in the standard include folders. Whereas when you write : #include "filename" with the double quote, it means that the compiler has to look for the file in the same folder as the file is compiling. That's why you need to watch out.

Sep 21, 2007 12:40 AM in response to Lynn M Peterson

Lynn M Peterson wrote:
Hi Computr821 ~

The path to stdio.h is: Hard Disk->Developer->SDKs->MacOSX10.4u.sdk->usr->include


This path is used when you use the framework, when you use the command line utility, the real path is : /usr/include/
You can access this folder using the menu Go --> Go to folder and typing this path : /usr/include/ in the text field, you should see stdio.h there.

stdio.h?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.