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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Missing C++ header files in Visual C++ 2003

Status
Not open for further replies.

smithpd

Programmer
Jul 8, 2002
20
0
0
US
I have been using Microsoft Visual C++ 6.0, and I just installed the .NET version, Visual C++ 2003. I converted a standard C/C++ console application from 6.0 to 2003 by opening the workspace file and accepting automatic conversion. Link and compile settings seem to be carried over. On compilation C++ 2003 could not find the header files in the following includes:

#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>

I thought these were standard. They work in MSVC++ 6.0. What gives?

I did a search, and those three header files are nowhere to be found in the 2003 install directory. I found three similar files, missing the ".h" extensions, that I included by

#include <iostream>
#include <fstream>
#include <iomanip>

These do not work either. Now the compiler finds the include files, but it cannot find declarations of cout, endl, and other functions and classes that are found in the standard headers (the .h files). The MSDN documentation says that cout, for example, is a member of <iostream>. but the compiler cannot find cout, even though it can find the file. I verified that cout is not mentioned in the file iostream.

I tried a blank project, and it had the same problem.

I had done a full install of the product and the documentation.

I find the 2003 documenation (MSDN) to be far inferior to that in 6.0. I can't find any clues about this. :(

Any ideas?
 
The files with .h are an old standard that is now gone. You should use the non-h versions. The only real difference is that now everything is in he namespace "std". Just add "using namespace std;" after you #include the files and everything will work. That's not the preferred method, people say you should actually say "using std::cout" and have basically 100 lines of using std::something, but since I've never had a single name clash, I say don't bother. You might also be interested in the some of the STL classes you are probably not familiar with: string class for strings and vector class for dynamic arrays are the most common ones.
 
Also, a lot of the old C header files were renamed also.
Here they are:
<cassert> <cctype> <cerrno> <cfloat> <ciso646> <climits> <clocale> <cmath> <csetjmp> <csignal> <cstdarg> <cstddef> <cstdio> <cstdlib> <cstring> <ctime> <cwchar>

Basically, just the old C header names without the .h and beginning with a 'c'. I haven't used VC++ .NET, so I'm not sure if you need to say 'using std::strcmp;' and so on, but with VC++ 6.0 you don't. You only need to do that with the C++ headers like <iostream>.
 
Thank you very much for pointing me in the right direction. I am surprised to be so old fashioned. I learned C++ about 6 years ago. We have a recent graduate working here who has not heard of these things. So, it looks like we need some new books. Well, onward and upward. :)

I have an additional question. Do these new standards apply to all platforms? Will they work using, say, G++ on a Unix machine? My objective is to do cross-platform development using the most standard coding I can.
 
Yes, these are part of the C++ standard. Any recent C++ compiler should conform to these standards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top