| | |
Beginner's question - Unable to open "include" file
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jan 2008
Posts: 17
Reputation:
Solved Threads: 0
I am working thru the Wrox book: Beginning Programming, and need some advice on getting a simple program to compile. I have Vista and use the free Borland C++ compiler. After entering in a simple C++ code, I was not able to get it to compile. When I attempted to compile the code, I received an E2209 error, the compiler was unable to open the include file 'iostream.h' In an attempt to troubleshoot the errors, I made some changes as follows using info from this site: http://dn.codegear.com/article/21205
A. Appended Environment Variables:
1. Opened Control Panel.
2. Navigated to System.
3. Clicked on "Advanced System Settings".
4. Clicked on the "Advanced" tab, to open the
"System Properties" window.
5. Clicked on the "Environment Variables" button.
6. Highlighted the "Path" System variable (bottom).
7. Clicked on the "Edit" button.
8. Appended the line with ";C:\BORLAND\BCC55\BIN;".
9. Clicked OK (3 clicks) and exited the System Properties
window.
B. Set up the configuration files:
1. From the command prompt, I changed directory to
"C:\BORLAND\BCC55\BIN"
2. Created the file BCC32.CFG. as follows:
a) Typed "edit bcc32.cfg" [Enter].
b) A blank window opened in the editor.
c) Entered the 2 lines below into the blank window.
-I"c:\Borland\Bcc55\include"
-L"c:\Borland\Bcc55\lib"
d) Created ILINK32.CFG in the same manner as above.
-L"c:\Borland\Bcc55\lib"
e) Saved the files and exited the command prompt.
f) Restarted Windows.
C. From Chapter 7 of Beginning Programming, I entered the following
code into a text editor(EditPad Lite):
// C++ code template
#include <iostream.h>
void main()
{
//code goes here
}
D. I saved the file as "Template.cpp" in C:\Progs.
E. From the command prompt I entered the following:
C:\borland\bcc55\bin\bcc32.exe C\Progs\Template.cpp
F. The output was as follows:
C:\Users\Allen>c:\borland\bcc55\bin\bcc32.exe c:\progs\template.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
c:\progs\template.cpp:
Error E2209 c:\progs\template.cpp 2: Unable to open include file 'iostream.h'
*** 1 errors in Compile ***
G. I have searched for the error and can't find it. My configuration
files are properly located at C:\Borland\BCC55\Bin. I have tried
experimenting with the appending in the Environment Variables
window. I entered iostream with and without the "h", and get
the same result.
Thanks in advance if you can help me out with this.
Allen
A. Appended Environment Variables:
1. Opened Control Panel.
2. Navigated to System.
3. Clicked on "Advanced System Settings".
4. Clicked on the "Advanced" tab, to open the
"System Properties" window.
5. Clicked on the "Environment Variables" button.
6. Highlighted the "Path" System variable (bottom).
7. Clicked on the "Edit" button.
8. Appended the line with ";C:\BORLAND\BCC55\BIN;".
9. Clicked OK (3 clicks) and exited the System Properties
window.
B. Set up the configuration files:
1. From the command prompt, I changed directory to
"C:\BORLAND\BCC55\BIN"
2. Created the file BCC32.CFG. as follows:
a) Typed "edit bcc32.cfg" [Enter].
b) A blank window opened in the editor.
c) Entered the 2 lines below into the blank window.
-I"c:\Borland\Bcc55\include"
-L"c:\Borland\Bcc55\lib"
d) Created ILINK32.CFG in the same manner as above.
-L"c:\Borland\Bcc55\lib"
e) Saved the files and exited the command prompt.
f) Restarted Windows.
C. From Chapter 7 of Beginning Programming, I entered the following
code into a text editor(EditPad Lite):
// C++ code template
#include <iostream.h>
void main()
{
//code goes here
}
D. I saved the file as "Template.cpp" in C:\Progs.
E. From the command prompt I entered the following:
C:\borland\bcc55\bin\bcc32.exe C\Progs\Template.cpp
F. The output was as follows:
C:\Users\Allen>c:\borland\bcc55\bin\bcc32.exe c:\progs\template.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
c:\progs\template.cpp:
Error E2209 c:\progs\template.cpp 2: Unable to open include file 'iostream.h'
*** 1 errors in Compile ***
G. I have searched for the error and can't find it. My configuration
files are properly located at C:\Borland\BCC55\Bin. I have tried
experimenting with the appending in the Environment Variables
window. I entered iostream with and without the "h", and get
the same result.
Thanks in advance if you can help me out with this.
Allen
Last edited by Allen 0108; Jan 5th, 2008 at 5:41 pm.
Well iostream.h isn't the standard name (it was in the old days, but not anymore).
Try
Oh, and main returns int, not void.
Try
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std;
Oh, and main returns int, not void.
•
•
Join Date: Jan 2008
Posts: 17
Reputation:
Solved Threads: 0
•
•
•
•
Well iostream.h isn't the standard name (it was in the old days, but not anymore).
Try
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std;
Oh, and main returns int, not void.
Thanks for your response Salem. I changed the code to:
// C++ code template
#include <iostream>
using namespace std;
int main()
{
// code goes here
}
And the output was:
C:\Users\Allen>c:\borland\bcc55\bin\bcc32.exe c:\progs\template.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
c:\progs\template.cpp:
Error E2209 c:\progs\template.cpp 2: Unable to open include file 'iostream'
Error E2282 c:\progs\template.cpp 3: Namespace name expected
*** 2 errors in Compile ***
I am not yet familiar with "namespace std;" but it appears the problem is with the include file, "iostream".
Here is some more information that could be relevant. I downloaded the compiler in Oct 2005 (just now getting around to learn how to program. I saved it to a directory in C:\;
I am using a new computer now with Vista. I copied the 2005 downloaded compiler from the old computer drive to the hard drive in my new computer, running Vista. I simply placed it in its own directory in C:\, just as I had done with the original download.
Typing C:\borland\bcc55\bin\bcc32.exe brings up the compiler. However, when I enter C:\borland\bcc55\bin\bcc32.exe C:\progs\template.cpp to compile the source code, I get the "unable to open include file error.
Last edited by Allen 0108; Jan 5th, 2008 at 7:13 pm.
Read Me
You'll also need to set the PATH environment variable as well, so you can run the compiler from any directory and just bcc32\bin
Also, you should begin by creating say c:\projects which will contain all your code projects. Don't be tempted to try and develop code within the compiler installation directory structure.
You'll also need to set the PATH environment variable as well, so you can run the compiler from any directory and just bcc32\bin
Also, you should begin by creating say c:\projects which will contain all your code projects. Don't be tempted to try and develop code within the compiler installation directory structure.
•
•
Join Date: Jan 2008
Posts: 17
Reputation:
Solved Threads: 0
•
•
•
•
Read Me
You'll also need to set the PATH environment variable as well, so you can run the compiler from any directory and just bcc32\bin
Also, you should begin by creating say c:\projects which will contain all your code projects. Don't be tempted to try and develop code within the compiler installation directory structure.
Regarding the Environment Variables, you mention I need to set the PATH environment variable. in Vista, there is a User Variable window and a System Variable window . The System Variable window contains the variable "Path" and the User Variable window contains the variable "PATH". The instructions say to append the System Variable "Path"with ;C:\BORLAND\BCC55\BIN. I noticed that the string I appended consisted of ;C:\BORLAND\BCC55\BIN;C:\Borland\BCC55\Include. I added the "Include" portion after noticing the E2209 include errors.
About the User Variable window, the value for PATH was empty when I first checked it. What should be the value for the User PATH variable? Should this be appended as well?
Thanks for your suggestions,
Allen
You should only need the \bin directory in your path, as that also helps it locate the .cfg file where the include path information is also stored.
system or user?
The system path is what all user's of your machine will see. The user path is of course unique to you. If it's only you using the machine, it's a fairly moot point.
You can check the result by opening a new cmd.exe and typing 'path' to display the current path. If that shows the \bin directory, you should be good to go.
system or user?
The system path is what all user's of your machine will see. The user path is of course unique to you. If it's only you using the machine, it's a fairly moot point.
You can check the result by opening a new cmd.exe and typing 'path' to display the current path. If that shows the \bin directory, you should be good to go.
•
•
Join Date: Jan 2008
Posts: 17
Reputation:
Solved Threads: 0
•
•
•
•
You should only need the \bin directory in your path, as that also helps it locate the .cfg file where the include path information is also stored.
system or user?
The system path is what all user's of your machine will see. The user path is of course unique to you. If it's only you using the machine, it's a fairly moot point.
You can check the result by opening a new cmd.exe and typing 'path' to display the current path. If that shows the \bin directory, you should be good to go.
Salem, Sorry to trouble you again with something that should be obvious, but I am still having some trouble with the command prompt. I did get the code to compile and the resulting (.exe), (.obj), and (.tds) files all ended up in the folder that contained the source code. This happened as it was supposed to. But the problem is that the only way it works is if I set the command prompt to C:\Borland\Bcc55\Bin>, the directory for the compiler. I have since written some more source code and succesfully compiled it, but only by doing so with the cmd prompt set to the Borland directory. I have made the necessary changes in the environment variables and have created the bcc32 and ilink32 files and made sure that they are located in the Bin folder. Where is the error?
Thanks for your help,
Allen
![]() |
Other Threads in the C++ Forum
- Previous Thread: How to ignore a scan through my ports???
- Next Thread: Quiz program
| Thread Tools | Search this Thread |
api array based beginner bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion count database delete deploy desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number output parameter pointer problem program programming project python random read recursion recursive return sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






