Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / December 2005



Tip: Looking for answers? Try searching our database.

Weird problem: gcc can't find an include file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vince Heuring - 29 Dec 2005 21:25 GMT
I'm helping (!?) my wife learn C, and she's stumbled over a missing
include file, #include <iostream>.

She's working from the terminal, and has Xcode 2 installed. It's gcc
4.0, and the include file is there:

homeboy% gcc --version
powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 20041026 (Apple Computer,
Inc. build 4061)

homeboy% find /usr/include -name iostream
/usr/include/gcc/darwin/3.3/c++/iostream
/usr/include/gcc/darwin/4.0/c++/iostream

The error msg is
homeboy% gcc peapods.c
peapods.c:1:20: error: iostream: No such file or directory

If I'm so bold as to include the path to iostream the world blows up:

homeboy% gcc -I/usr/include/gcc/darwin/4.0/c++/ peapods.c
In file included from peapods.c:1:
/usr/include/gcc/darwin/4.0/c++/iostream:44:28: error:
bits/c++config.h: No such file or directory
In file included from /usr/include/gcc/darwin/4.0/c++/ios:44,
                from /usr/include/gcc/darwin/4.0/c++/ostream:45,
                from /usr/include/gcc/darwin/4.0/c++/iostream:45,
                from peapods.c:1:
/usr/include/gcc/darwin/4.0/c++/iosfwd:46:29: error: bits/c++locale.h:
No such file or directory
/usr/include/gcc/darwin/4.0/c++/iosfwd:47:25: error: bits/c++io.h: No
such file or directory...
and 4000+ more lines of err msgs.

An Xcode Command Line C++ project compiles and runs fine with her code.

What's up here?

TIA.

Signature

Vince Heuring To email, remove the Vince.

John Whorfin - 29 Dec 2005 22:20 GMT
> I'm helping (!?) my wife learn C, and she's stumbled over a missing
> include file, #include <iostream>.

iostream is a C++ header.

> homeboy% gcc peapods.c

If peapods.c is supposed to be C then you can't use iostreams.
If it is C++ then it should have a C++ extension of which there
are a number.  I prefer ".cpp" but ".cxx" is common.  Then to
compile it use "g++" in place of "gcc".
Vince Heuring - 30 Dec 2005 00:35 GMT
> > I'm helping (!?) my wife learn C, and she's stumbled over a missing
> > include file, #include <iostream>.
[quoted text clipped - 7 lines]
> are a number.  I prefer ".cpp" but ".cxx" is common.  Then to
> compile it use "g++" in place of "gcc".

ARRGGHH. Thanks.

Signature

Vince Heuring To email, remove the Vince.

Jalapeno - 29 Dec 2005 22:21 GMT
> I'm helping (!?) my wife learn C, and she's stumbled over a missing
> include file, #include <iostream>.
>
> <snip>

> An Xcode Command Line C++ project compiles and runs fine with her code.
>
> What's up here?

Perhaps C is not C++ ?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.