PRB: Including STL.H Causes Compiler ErrorsLast reviewed: January 9, 1997Article ID: Q154539 |
The information in this article applies to:
SYMPTOMSPrograms that include "STL.H" generate different compiler errors, depending on the STL template class you try to instantiate. The compiler errors are all in STL header files. The sample code below illustrates some of these errors.
CAUSESTL.H contains typographical and syntax errors.
RESOLUTIONSTL.H was included with Visual C++ 4.2 by mistake. It is not part of the ANSI standard for Standard C++ Libraries and should not be used. Instead, include the individual header files associated with the particular STL component(s) the program is using. The sample code below, for example, will compile and run correctly if "#include <stl.h>" is changed to "#include <vector>."
STATUSThis behavior is by design.
MORE INFORMATION
Sample Code
/* Compile options needed: */ //workaround: change the following line to #include <vector> #include <stl.h> //workaround: change the "typedef" to: //typedef vector<int, allocator<int> > INTVECT;typedef vector<int> INTVECT;
void main(){ INTVECT ivect;}
|
KBCategory: kbprg kbprb
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |