Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opening the include file iostream.h

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi,
i am new to c++ and i am just learning the hello world program. my compiler is "borland turbo c++" and the program is as follows (which you already know):

#include <iostream.h>


int main();
{
cout <<&quot;Hello World!\n&quot;;
return 0;
}


but when i compile the program, it gives me two errors:-
1)unable to open file include file iostream.h (line 1)
2)declaration terminated incorrectly (line 5)

For the first problem, a book said &quot;check your compiler documentation for directions on setting up your include path or environment variables&quot;, but i don't no what it means. so could you please give me a solution?
Thank you very much.
 
try locating the iostream.h file on your drive (do a search for it in windows explorer) then look at its properties and copy the path. Paste the path in the include
for example

#include <D:\Program Files\Borland\CBuilder\Include\iostream.h>
 
i tried it but it doesn't work. i don't think the trouble is to find the file but to open it. so if u know a way to fix it please let me know.
thanks
 
i tried it but it doesn't work. i don't think the trouble is to find the file but to open it. so if u know a way to fix it please let me know.
thanks
 
The problem is that it can't find the file and thus can't open it. So if you tried what Wings suggested and you didn't find the file at all, then it's possible that you just don't have the file, which would be bad. I'd suggest looking again, and if you still can't find it, see if you installed everything properly.

I don't think this could be what's wrong, but before you reinstall or anything, try removing the .h and just saying #include <iostream>.
 
i am sorry but just putting iostream doesn't help either. and before, it used to say that it couldn't &quot;find&quot; the file, but now it says that it can't &quot;open&quot; it(i changed the environment variable path in my computer\properties). so that's why i thought that the problem was opening and not finding it. thanks for helping.
 
hi,
when i told someone my problem, he asked me whether i had the file ilink32.cfg. i saw that i didn't. is it important? could you please tell me how to get it and when i do, how to use it? thank you.
 
hi,
when i told someone my problem, he asked me whether i had the file ilink32.cfg. i saw that i didn't. is it important? could you please tell me how to get it and when i do, how to use it? thank you.
 
The link config file is not necessary if all your Turbo C++ directories are in your path. Can you open your iostream header file with an editor like EDIT? If not, your file may be trashed. BTW, have you followed that advise about the extra ';'? James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that they think I am now
qualified to do anything with nothing.
 
hey when i say #include <iostream.h> it didnt work so i tried putting the path by searching with explorer and then copying. it still didnt work but now it says it just cant open it. i tried removing the h and it still says it cant open it. so now i have #include <C:\TC\INCLUDE\iostream> and it still doesnt work. whats wrong?
 
The backslash is an escape character in C++; that is, it causes the next character to be interpreted specially. If you really want a backslash, you have to put two (the first one causes the next backslash to be interpreted as a regular backslash). So you'd need:

[tt]#include <C:\\TC\\INCLUDE\\iostream>[/tt]
 
ok will i did that and it still didnt work. i dont know y. isnt it when u type #include that it is supposed to like highlite the words? it doesnt do that. is that just because it is an older compiler. i know my comp has the libraries it say it just cant open them. did i set something up wrong. reinstalling didnt work...
 
can u name everything u are supposed to do after u install before u are supposed to actually start writing programs?
 
Highlighting doesn't have anything to do with it; that's a function of the editor, not something in C++. You say you're using Turbo C++? Look on the menus for &quot;Directories.&quot; Make sure the include path is set to the place where your include files are located.
 
well i checked and it was set to the right place but it still says it is unable to open include file c:\\tc\\include\\iostream i tried #include iostream.h and iostream it still didnt work. y cant it open up the file. i am using the borland turbo c++ v1.01 yes it is old but it should still work since i checked and it does have all the libraries like iostream and conio
 
No, it's not a namespace problem. In fact, the version of Turbo C++ being discussed didn't even have namespaces.

need to know, what were you saying earlier about highlighting? On my Turbo C++ 3.0 (a little later than yours), starting any line with a # makes the background light blue and the words dark blue (by default). What color is your background/text for the include line?

If it's all yellow, it's possible it thinks the file is a regular text file. I doubt that's the case, since it knows it's looking for an include file, but let's check anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top