开发者

Using the Standard Template Library with Visual Studio 4.0

I am trying to compile some code using version 4.0 of Visual C++ Studio.

I understand that I need to use the standard template library for this code, here is where the compiler stops with an error:

#include <fstream>

fatal error C1083: Cannot open include file: 'fstream': No such file or directory

Looking at the compiler install disk the STL files are not installed with the compiler, but I found the subdirectory where they are on the install disk. I have never used the STL and am not sure where exactly to place the files. For now I have placed them in a subdirec开发者_JAVA百科tory of my source files and added that directory to Build->Settings->Resources->Additional Resource Include Directories. Also note there is no file named fstream or fstream.h in the STL directory.

In the read.me is this note:

(1) STL is the container, iterator, algorithm part of the C++ standard library, it is not the complete standard library. (I/O streams, strings, etc. are not included in this package.)

So I am a bit confused - do I need to get additional source files somewhere, or how should I proceed? Thanks for any help!


Visual C++ 4.0 is OLD!. It doesn't support STL properly. You should use at least use VC++ 6.0 (which does at least supports most of it) or better still use VC++ 2005 or 2008 express editions. Or you can use the GNU G++ compiler (through MinGW) which implements STL very nicely.

At the time VC++ 4.0 was made , C++ was not standardized (and STL is a subset of the C++ Standard Library) so it doesn't support most STL features or implements a non-standard version of them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜