vico
vico

Reputation: 18171

winnt.h include problems

I have simple console application that was part of another solution. I decided to have this application separately in new solution. After I have opened this application and saved in newly created solution I have following errors:

Error   9   error C2059: syntax error : ')' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12984
Error   4   error C2065: 'PCONTEXT' : undeclared identifier c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12983
Error   10  error C2143: syntax error : missing ';' before '__stdcall'  c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 13372
Error   5   error C2146: syntax error : missing ')' before identifier 'ContextRecord'   c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12984
Error   1   error C2146: syntax error : missing ';' before identifier 'ContextRecord'   c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 6361
Error   7   error C2182: 'RtlCaptureContext' : illegal use of type 'void'   c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12984
Error   8   error C2491: 'RtlCaptureContext' : definition of dllimport data not allowed c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12984
Error   13  error C3861: '__readfsdword': identifier not found  c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 14982
Error   2   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 6361
Error   3   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 6361
Error   11  error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 13372
Error   12  error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 13376
    14  IntelliSense: identifier "PCONTEXT" is undefined    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 6361
    15  IntelliSense: identifier "PCONTEXT" is undefined    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12983
    16  IntelliSense: identifier "PCONTEXT" is undefined    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 13371
Warning 6   warning C4229: anachronism used : modifiers on data are ignored c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winnt.h 12984

It's much more easily for me to create new console application than find what is wrong in that situation, but to get more experience I decided to find what is wrong. I have compared C/C++ and Linker settings of both of these applications (newly creatded compiling app and one with errors) and found no differences between them. Where might be problem and what is the way of slowing such problems?

Upvotes: 3

Views: 5330

Answers (1)

Nabeel
Nabeel

Reputation: 67

If anyone finds this through Google like me: For CLI/C++ projects, make sure any unmanaged .cpp files you are including are set to compile with No CLR support. See below link with answer from Hans Passant.

This fixed this issue for me.

C++ CLI Correct way to use #pragma managed / unmanaged

Upvotes: 1

Related Questions