Visual Studio 2012 alongside 2010 - kernel32.lib, windows.h

前端 未结 2 735
臣服心动
臣服心动 2021-02-14 14:41

I just installed Visual Studio 2012 alongside Visual Studio 2010. The problem is that I can\'t manage to convert simple projects from 2010 to 2012 - they fail to link to files s

相关标签:
2条回答
  • 2021-02-14 15:00

    I know there's almost an answer above. But...

    The problem seems to be that when VS2012 and VS2010 are installed, the configuration for VS2012 does not work correctly.

    The fix is to edit the props files in %home%\AppData\Local\Microsoft\MSBuild\v4.0.

    These are the files that worked for me, using SDK v8.1.

    First Microsoft.Cpp.Win32.user.props which is used for 32-bit builds:

    <?xml version="1.0" encoding="utf-8"?> 
    <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <IncludePath>C:\Program Files (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program Files (x86)\Windows Kits\8.1\include\winrt;$(IncludePath)</IncludePath>
        <LibraryPath>C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86;$(LibraryPath)</LibraryPath>
        <ExecutablePath>C:\Program Files (x86)\Windows Kits\8.1\bin\x86;$(ExecutablePath)</ExecutablePath>
      </PropertyGroup>
    </Project>
    

    Now Microsoft.Cpp.x64.user.props which is used for 64 bit builds:

    <?xml version="1.0" encoding="utf-8"?> 
    <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <IncludePath>C:\Program Files (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program Files (x86)\Windows Kits\8.1\include\winrt;$(IncludePath)</IncludePath>
        <LibraryPath>C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64;$(LibraryPath)</LibraryPath>
        <ExecutablePath>C:\Program Files (x86)\Windows Kits\8.1\bin\x64;$(ExecutablePath)</ExecutablePath>
      </PropertyGroup>
    </Project>
    

    I hope this helps others with this problem, I haven't found a solution posted anywhere else.

    0 讨论(0)
  • 2021-02-14 15:00

    I had a similar problem.
    In my case this was because the correct paths weren't inherited in the project settings.

    Check that the paths are inherited in: Project -> Properties -> VC++ Directories
    Under Include and Library Directories go to Edit.

    Make sure that the Inherit from parent or project defaults is checked.

    The VS2012 default properties and Macros were set correctly. (Although I had the common installation problems where I had to replace all the VC directory because it didn't even install the C++ core libraries)

    0 讨论(0)
提交回复
热议问题