Search code examples
c++winapiwindows-7stlwdk

Very Mysterious/Random C++ WDK STL 7 Error: iosfwd(202): error C2144: syntax error


I have the following trivial file named Temp.cpp:

#include <string>
int main() { return 0; }

and I'm trying to compile it with the following command-line in the Windows XP Free Build Environment, using WDK 7.1:

cl.exe /Iinc\api\crt\stl70 /Iinc\crt C:\Temp.cpp

and I'm getting really random errors like:

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.207 for 80x86

C:\WinDDK\7600.16385.1\inc\api\crt\stl70\iosfwd(202) :
    error C2144: syntax error : 'int' should be preceded by ';'

The error goes away if I use stl60 instead of stl70, but that doesn't solve the problem.

What's the cause of the problem?


Update: I tried uninstalling and installing the WDK again, but nothing changed. :(


Update 2: Okay, apparently the error is screaming out at the header file itself: _SCL_INSECURE_DEPRECATE is the cause. Does anybody know how to turn it off correctly? (If I just comment out the lines, I get a ton more errors regarding a bunch of other macros.)


Solution

  • Found the answer myself, through modifying the headers and guess'n'checking:

    I need to have _STL70_ defined.