standard C no better
Actually, you are trying to compile a c++ program - your header imports, namespace declaration and input and output statements are c++. Anyway, gcc is a standard C compiler
What I find interesting is the missing files are being looked for in the gcc 3.1 directories - what version of XCode do you have installed? What does typing "gcc -version" show?
I have XCode 3 and I have only gcc 4 installed.
Ok ... I removed all the cin and cout statements and replaced them with "standard C" calls to printf and scanf. I have removed all the include statements except the one for iostream and then put one in for stdio.h. Here is the source program now:
admin% cat try.cpp
#include <iostream>
#include "stdio.h"
int main ()
{
int celsius;
printf ("Enter the temperature in celsius:");
scanf ( "%d", celsius);
int fahrenheit;
fahrenheit = 9 * celsius/5 + 32;
printf ( "fahrenheit value is: %d\n, farenheit);
}
when i invoke "gcc try.cpp", I get a similar stream of error messages, included in which are three "No such file ..." errors, which appear to be the heart of the problem:
stddef.h: No such file or directory
/usr/include/gcc/darwin/3.1/g++-v3/cstdio:52:19: stdio.h: No such file or directory
/usr/include/gcc/darwin/3.1/g++-v3/ppc-darwin/bits/gthr-default.h:37:21: pthread.h: No such file or directory
Clearly, my new #include line for "stdio.h" did not work. And my error message that refers to stdio has changed, too.
Here is another news flash. I removed the #include line for <iostream> and most of the error messages went away. Of course, it still could not find stdio.h, since that does not appear to exist ANYWHERE on this machine, and so printf and scanf are not defined, but those are clearly the result of not finding stdio.h so those errors are understandable.
I would be satisfied if I could compile this program (and, therefore, my more complicated program) in the standard C environment or in the C++ environment. Either one would be OK, as long as it works. I would change the I/O lines to match the environment that works.