multiple compiling errors with basic C++ application on VS2010 Beta 1

27,614

Solution 1

Just use '$(IncludePath);C:\WinDDK\6001.18001\inc\api' as include directories.

Solution 2

Something is wrong with your include path. Use the the "/showIncludes" option ("Configuration Properties/C/C++/Advanced/Show Includes" in the IDE's project options) to see what headers are being included from where.

See this question for more details:

Solution 3

I had the same problem after adding the path to the DDK directory in the project property pages under

Configuration Properties -> C/C++ -> Additional Include Directories

After changing the location to

Configuration Properties -> VC++ Directories -> Include Directories

and adding the path to the DDK after $(IncludePath) everything worked fine.

Juriy Petrochenkov was on the right track with his remark, so I rechecked where I have added the DDK directory to, and, lo and behold, it was the wrong one. Thank's Juriy!

Solution 4

I have the same problem, you can copy sal.h from Microsoft Visual Studio 10.0\VC\include to WinDDK\7600.16385.1\inc\api\ and copy Microsoft Visual Studio 10.0\VC\include\CodeAnalysis to WinDDK\7600.16385.1\inc\api\.

Solution 5

I have found that my include directory was inheritting from parent or project defaults. The problem is that in VS2010 the Global options for include paths has been removed. After some searching, I found that the two files that contained these settings (From my previous install of VS) were in the following directory:

C:\users\username\appdata\local\microsoft\msbuild\v4.0\

The two files are:

  1. Microsoft.Cpp.Win32.user.props
  2. Microsoft.Cpp.x64.users.props

Edit the IncludePath variable

Remove the DDK path, saved the file, and restarted VS2010. This resolved my issue for all new projects.

Share:
27,614
user112771
Author by

user112771

Updated on July 09, 2022

Comments

  • user112771
    user112771 almost 2 years

    I just recently installed VS2010 Beta 1 from the Microsoft website , I started a basic C++ Win32 Console Application , that generated the following code:

    #include "stdafx.h"
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    
    return 0;
    }
    

    I tried compiling the code just to see how it runs and just then I encountered several(over a 100) compiling errors.

    Here is the first part of the build output:

    1>ClCompile:
    1>  stdafx.cpp
    1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2065: '_In_opt_z_' : undeclared identifier
    1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2143: syntax error : missing ')' before 'const'
    1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): warning C4229: anachronism used : modifiers on data are ignored
    1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2182: '_invalid_parameter' : illegal use of type 'void'
    1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2491: '_invalid_parameter' : definition of dllimport data not allowed
    1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2059: syntax error : ')'
    1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(527): error C2065: '_In_opt_z_' : undeclared identifier
    1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(527): error C2143: syntax error : missing ')' before 'const'
    1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(527): warning C4229: anachronism used : modifiers on data are ignored
    

    pastebin for the full list

    I thought maybe the include files got mixed up by some other compiler version I have installed previously( I have VS 2008 as well) so I reinstalled VS2010 just to overwrite the headers but that didn't do much.

    Thanks in advance for any help you might offer as I am helpless

  • user112771
    user112771 over 14 years
    I have never built this project with a prior version , it's a new project , I tried cleaning it and then recreating it without precompiled headers but still the same problems occur
  • user112771
    user112771 over 14 years
    I have a read that solution somewhere , it regarded people using an old standard way using "int main()" instead of "int _tmain" and such , not only that I used "_tmain" but I also tried changing that setting which didn't solve the problem
  • t.g.
    t.g. over 14 years
    if you are running on XP, there's a bug of installing beta 1 on XP. please check whether or not you have this property sheet: "Microsoft.Cpp.Win32.User". If not, try this link: blogs.msdn.com/vsproject/archive/2009/07/07/vc-directories.a‌​spx
  • Nusrat Nuriyev
    Nusrat Nuriyev over 10 years
    /showIncludes option is, generally, on of the best things that comes to mind in such kind of problems.