Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > what is wrong with thoes INCLUDE?

what is wrong with thoes INCLUDE?
Thread Tools
Dedicated MacNNer
Join Date: Aug 2004
Status: Offline
Reply With Quote
Feb 28, 2005, 02:20 AM
 
#include <stdio.h>
#include <iostream.h>
#include <stdlib.h>
this is the head of code i got form the lecture, and can not run on mac, why?
As my teacher using VS6.0, so what is the diff between using xcode and VS6.0, as i thought i just use C
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
     
Forum Regular
Join Date: Dec 2004
Status: Offline
Reply With Quote
Feb 28, 2005, 02:52 AM
 
Originally posted by maCCer:
#include <stdio.h>
#include <iostream.h>
#include <stdlib.h>
this is the head of code i got form the lecture, and can not run on mac, why?
As my teacher using VS6.0, so what is the diff between using xcode and VS6.0, as i thought i just use C
Show us the error the compiler is giving you, and we may be able to guess. Odds are pretty good that you are trying to compile with a C compiler, instead of C++, in which case, iostream.h isn't an accessible .h file, since it is a C++ file.

If I compile a file called test.c with those includes and compile with gcc, I get:

gcc test.c
test.c:2:22: iostream.h: No such file or directory
If I compile the exact same file with g++, it compiles quite happily.

Try changing the name to a cplusplus suffix (like cpp) which a C compiler should recognize as needing to be compiled as cplusplus.

--sam
     
maCCer  (op)
Dedicated MacNNer
Join Date: Aug 2004
Status: Offline
Reply With Quote
Feb 28, 2005, 05:59 PM
 
Originally posted by ideasculptor:
Show us the error the compiler is giving you, and we may be able to guess. Odds are pretty good that you are trying to compile with a C compiler, instead of C++, in which case, iostream.h isn't an accessible .h file, since it is a C++ file.

If I compile a file called test.c with those includes and compile with gcc, I get:



If I compile the exact same file with g++, it compiles quite happily.

Try changing the name to a cplusplus suffix (like cpp) which a C compiler should recognize as needing to be compiled as cplusplus.

--sam
thx, i got the wrong compiler, stupid myself
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:12 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2