View previous topic :: View next topic |
Author |
Message |
tomkamphuys n00b
Joined: 21 Jun 2002 Posts: 74 Location: The Netherlands, Den Ham (Ov.)
|
Posted: Fri Feb 21, 2003 2:31 pm Post subject: [C++] Unable to open include file 'iostream' |
|
|
I have to write a c++ program for a course at the university. Since it is for the first time, it is a little hard. I do this project with 3 other people and we have divided the classes, so we all do some of the programming. I've almost completed my classes and have tested them. I'm pretty satisfied.
The other people also have finished writing their classes more or less. Now I'd like to put them all together in order to test the complete program. I'm using Borland c++ 5.02 IDE and I've tried to add the .cpp files as a node. I've also included the header files where I think they're needed.
BUT...
I get a lot of errors : Unable to open include file 'iostream'
and other similar errors.
Before adding the files from my 'colleagues' the compiler( ? ) opened these files correctly. That is, my part of the program works.
What is going on? _________________ tap = hijskraan |
|
Back to top |
|
|
tomkamphuys n00b
Joined: 21 Jun 2002 Posts: 74 Location: The Netherlands, Den Ham (Ov.)
|
Posted: Tue Feb 25, 2003 4:58 pm Post subject: |
|
|
Well, I think I solved the problem. I've included
Code: |
#ifndef _FOO_H
#define _FOO_H
// code
#endif // _FOO_H
|
Now I don't get the above error messages anymore.
Instead of those I get a bunch of new ones......
type name expected
Multiple decleration for 'Item::GeleendItem' _________________ tap = hijskraan |
|
Back to top |
|
|
shaniac n00b
Joined: 27 Jun 2002 Posts: 23
|
Posted: Wed Feb 26, 2003 12:17 am Post subject: gcc 3.2.2 problems |
|
|
Some package autoconf told me my c++ compiler couldn't generate executables. I thought that was nonsense, so I wrote a little "Hello, World!" program in c++ (I don't use c++ very much, so it had to be simple). It couldn't find <iostream>.
So, something is wrong. I recently updated to gcc-3.2.2, and I was here on the forums looking to see if anyone else was having problems. I guess someone is!
If I find anything, I'll post here. |
|
Back to top |
|
|
Neodraco Apprentice
Joined: 25 Feb 2003 Posts: 167 Location: Castelló, España
|
Posted: Wed Feb 26, 2003 1:07 am Post subject: |
|
|
I don't know Borland IDE but try compiling your files from the command-line, with g++. If it works, it's problem of your IDE configuration. _________________ Signature wanted... Reward 10.000 € |
|
Back to top |
|
|
shaniac n00b
Joined: 27 Jun 2002 Posts: 23
|
Posted: Wed Feb 26, 2003 2:38 am Post subject: Update |
|
|
I notice that in my /etc/profile.env, my path still points to /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2 instead of 3.2.2. So, I changed my path to point to 3.2.2, and now my program compiles *if* I use the old-style header name <iostream.h> (of course, it complains) but it will not compile if I use <iostream>.
I'm going to look at the bug reports; gcc builds have been troublesome, lately....
UPDATE: it would be easier to sell your children for crack cocaine and automatic weapons on Ebay, than it is to navigate Bugzilla. Other people are having similar problems. |
|
Back to top |
|
|
zhenlin Veteran
Joined: 09 Nov 2002 Posts: 1361
|
Posted: Wed Feb 26, 2003 9:08 am Post subject: |
|
|
Always env-update && source /etc/profile after a gcc emerge. |
|
Back to top |
|
|
tomkamphuys n00b
Joined: 21 Jun 2002 Posts: 74 Location: The Netherlands, Den Ham (Ov.)
|
Posted: Thu Feb 27, 2003 1:18 pm Post subject: |
|
|
Well, solved that too. Had to write class before the class name.
And to all the guys trying to help me with gcc, thanks but....... I'm programming under Windows with Borland C++ _________________ tap = hijskraan |
|
Back to top |
|
|
forumboy n00b
Joined: 21 Feb 2003 Posts: 8
|
Posted: Thu Mar 13, 2003 3:37 am Post subject: |
|
|
I actually have the same problem that #include <iostream> or #include <iostream.h> will generate a lot of error/warning message while try to compile a c++ program (even the smplest hellow world program).
I found the solution on other post in the forum. Just post here in-case you still looking for the solution.
You have to use g++, not gcc to compile your c++ program.
I'm using Anjuta as the IDE, i dont know how to tell Anjuta to compile with g++. Then i got the idea changing the file extension from hello.c to hello.cpp. Build again, it work! |
|
Back to top |
|
|
|