Visual Studio + include Statement issues

Jan 18, 2010 at 8:36pm
Just a quick question, I have a program I am making which uses source code which was written by someone else (legitimately I might add) anyhow it has the following:

Code File
1
2
3
#include <stdio.h>
#include <fstream.h>
#include <iostream.h> 


Header
1
2
3
#include <assert.h>
#include <strings.h>
#include <iostream.h> 


in visual studio i get the error:

Error 1 error C1083: Cannot open include file: 'fstream.h': No such file or directory
2 IntelliSense: cannot open source file "strings.h": Bad file descriptor
3 IntelliSense: cannot open source file "iostream.h"
...


Actually that list goes on for a while with every datatype it uses from them generating an error.

How do I resolve this.

Thanks
Jan 18, 2010 at 8:49pm
Those are pre-standard header files.
The current are:
1
2
3
4
5
6
7
#include <cstdio>
#include <fstream>
#include <iostream> 

#include <cassert>
#include <string>
#include <iostream> 
Last edited on Jan 18, 2010 at 8:50pm
Jan 18, 2010 at 9:04pm
Thanks will all the vars still be current?
Jan 18, 2010 at 9:06pm
do you treat the following the same as a .h and C++ if coded correctly, or is it just a different file type.

dataFile.cc
dataFile.hh
Jan 18, 2010 at 9:07pm
Thanks will all the vars still be current?
You have to try. Another thing I may add is that all new headers contain their symbols in the std namespace
do you treat the following the same as a .h and C++ if coded correctly, or is it just a different file type.
Yes
Last edited on Jan 18, 2010 at 9:08pm
Jan 18, 2010 at 9:10pm
right I changed them over now I get a tons of

cerr: undeclared identifier
istream: undeclared identifier
endl: undeclared identifier
stream: undeclared identifier
ifstream: undeclared identifier
ostream: undeclared identifier

I am guessing that they can not be easily replaced then?
Jan 18, 2010 at 9:12pm
Ah adding the namespace helped.

let me see if I can figure out what the rest of the errors are (ill be back)
Jan 19, 2010 at 11:02am


Well i have also encountered the same problem in visual studio 2005
when i have given the header file #include<iostream.h>

Error 1 fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory c:\documents and settings\ssharm04\my documents\visual studio 2005\projects\c++_general\c++_general\stdafx.h 15

So try giving #include<iostream> in stdafx.h

and in the source file use the namespace std,if you are using and std functions.

Hope it might helps.

PS:
I dont know the reason, but if anyone knows , please let me know.Thanks in advance.

Jan 19, 2010 at 1:04pm
iostream.h is a pre-standard header so on modern compilers won't work
Topic archived. No new replies allowed.