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 such as kernel32.lib or include files such as windows.h. My system also has Windows SDK 7.1 installed.
I have tried messing with Property Manager for my x86 and x64 user platforms (since I had appropriate $(DXSDK_DIR) references added there), only to get mixed results - sometimes it just works, sometimes it compiles but doesn't link, other times it simply stops at windows.h
For example, currently I'm getting
1>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
or
1>Source.cpp(2): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
(depending on the inclusion or not of "windows.h") with a simple "hello world" type program only in x64.
In the project properties for Active(Debug) / Active(x64) -> VC++ Directories -> Include Directories
I can now see $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);$(DXSDK_DIR)Include
. If I expand that input box and I click Edit, I see:
$(VCInstallDir) = C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\
$(WindowsSDK_IncludePath) = c:\Program Files (x86)\Windows Kits\8.0\Include\um;c:\Program Files (x86)\Windows Kits\8.0\Include\shared;c:\Program Files (x86)\Windows Kits\8.0\Include\WinRT
While my platform toolset v110 windows.h resides at c:\Program Files (x86)\Windows Kits\8.0\Include\um\Windows.h
(so there should be no problem). Stuff works if I select Windows SDK 7.1 as platform toolset.
Any solution besides formatting and reinstalling Windows?
L.E. if I replace the $(variable) directories with absolute paths within the system, everything works. I don't see why I would do this, since I am sharing the project with others as well.
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)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With