Microsoft KB Archive/154539

= PRB: Including STL.H Causes Compiler Errors =

Article ID: 154539

Article Last Modified on 11/18/2003

-

APPLIES TO

 The Standard C++ Library, when used with:  Microsoft Visual C++ 4.2 Enterprise Edition

 Microsoft Visual C++ 4.2 Professional Edition 

-



This article was previously published under Q154539



SYMPTOMS
Programs 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.



CAUSE
STL.H contains typographical and syntax errors.



RESOLUTION
STL.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 ."

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

Sample Code
/* Compile options needed:

//workaround: change the following line to #include
 * 1) include <stl.h>

//workaround: change the "typedef" to: //typedef vector<int, allocator > INTVECT; typedef vector INTVECT;

void main {    INTVECT ivect; }

Additional query words: 4.20 kbdsd STL STL.H allocator vector deque list map multimap set multiset queue stack priority_queue

Keywords: kbprb KB154539

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.