missing header file on a new installation of visual studio 2012 - visual-c++

I just installed visual studio 2012 and tried running my C++ project on it.
compilation fails due to missing "SDKDDKVer.h", "windows.h", etc.
I installed the windows 8 sdk from Windows Software Development Kit (SDK) for Windows 8, but after successfully running the installer with the default components (including the windows headers), I can't find any include folder under C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0 or C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A.
I ran the SDK installer twice + tried to repair and still I can't find any trace of the windows header files.
Did anyone encounter something similar?
what am I missing? my OS is win7 x64. I uninstalled VS2010 before installing VS2012.
thanks,

It's a bug caused by VS2012 using the configuration of VS2010.
You have to manually fix the include libraries to get around this (through the property manager).
The substantial modifications needed are :
adding $(WindowsSDK_IncludePath) to the include paths
adding $(WindowsSDK_LibraryPath_x86) or $(WindowsSDK_LibraryPath_x64)
to the library path depending if your building for x84 or x64.

The same problem also exists when you upgrade a VS2010 project to VS2012.
To me, manually fixing the include dirs (see step 1 in previous answer) took care of the problem.

Related

error cannot open file 'kernel32.lib'

I have installed VS2013 and VS2015 on Windows 7.
I have an existing C++ Dll project that was building fine but now all of a sudden it wont build using VS2015 and gives me the error:
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
From this post: fatal error LNK1104: cannot open file 'kernel32.lib' I went looking for the kernel32.lib file and it is located here:
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86
When I go to my Projects Properties-->Linker-->Input and select Macros I see that this path is indeed there:
My Platform Toolset is set to Visual Studio 2013 - Windows XP (v120_xp) which is what it always has been set to.
Why has my Project all of a sudden stopped building? What could have gone wrong?
I had this similar problem today with Visual Studio 2013 when I changed my VC++ Directories:
Project->Properties->VC++ Directories:
Include Directories
If the cause is some plug-in/extension that changes your props files, it may in consequence change the "Visual C++ Directories" settings of your project.
So, the solution that worked for me is described on my own answer Can't compile 64 bits Visual Studio 2010 projects, which I fully transcribe to here:
After I asked a colleague for help, we noticed, that even getting
clean builds of the projects from TFS, with overwrite option, the
Project's Configuration Properties > VC++ Directories on my computer
were always different from other computers.
Searching more we found the solution on the last post of Reset
include/lib path, which I will fully transcribe:
use "del %HOMEPATH%\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props"
is not always the right way.
Better use "del %USERPROFILE%\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props"
where the application data folder is normally placed in.
Then I've looked inside the contents of Microsoft.Cpp.x64.user.props
and I've seen that there were things added by Visual Leaks Detector.
Which is reasonable, as one month before, I did a memory leak analysis
using VLD.
So, I deleted the file and now everything compiles fine at 64bits!
I had to install the Visual C++ for Desktop Development.
Open Visual Studio Installer and go to Installed tab. Click on the Change Button on your installed Visual Studio Community Edition. -> On the Workloads Tab there should be a option Desktop Development with C++. Activate that option and modify the changes.
Afterwards it was working for me.
I had the same problem today. As it turned out somehow the SDK 10.0.15063.0 got installed on my system but without the Desktop C++ files. Selecting the SDK in the list of installed programs, doing a change install and there selecting the Desktop C++ options added the necessary files and now I can link again.
I got this error fatal error lnk1104: cannot open file 'kernel32.lib'.
this error is getting because there is no path in VC++ directories.
To solve this probelem
open visual studio 2008
go to Tools-options-Projects and Solutions-VC++ directories-*
then at right corner select Library files
here you need to add path of kernel132.lib
In my case It is C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
Thank you.
I had this following upgrade of some projects from VS2013 to VS2017.
Original project had a manual modification to the "Library Directories" item under VC++ Directories in the project settings.
This meant it did not pick up changes from the upgrade.
Using the option will reset this to something that works (assuming the SDK is installed OK) provided anything other than the default is not needed of course. In my case it was trying to point at the v7.1 SDK but that was not installed for vs2017.
in vs 2019, just run the installer, click modify, and then in the individual components tab, remove windows 10 SDK. then again run the installer and add windows 10 sdk!
I had this similar problem today with Visual Studio 2017. My cause turned out to be a bad environment setting in NETFXSDKDir, specifically:
NETFXSDKDir=C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1
It needed to have a value of:
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x86
I have a more detailed response here:
fatal error LNK1104: cannot open file 'kernel32.lib'
In VS 2022 I was trying to compile an old solution that originally ran in VS 2010 then in VS 2019. It continually gave me the "cannot find Kernel32.lib" error. I spent 8 hours trying everything, including everything on this page. What worked for me: Configuration Properties -> VC++ Directories -> Library Directories and "inherit from parent" (guessing this sets to defaults) fixed this for me. Also note: I'm using winsock and directinput.

Visual Studio extension conflict when removing a project

After I save the changes of a solution and then remove an existing project, I'll get the following error message:
The operation could be completed. Not implemented.
Then I launched devenv.exe /Log and able to reproduce the problem and the errors are:
Extension will not be loaded because an extension with the same ID 'Microsoft.Windows.DevelopmentKit.Desktop' is already loaded at
C:\PROGRAM FILES (X86)\COMMON FILES\MICROSOFT\EXTENSIONMANAGER\EXTENSIONS\MICROSOFT\WINDOWS KITS\8.0\DESKTOP SDK\
C:\PROGRAM FILES (X86)\COMMON FILES\MICROSOFT\EXTENSIONMANAGER\EXTENSIONS\MICROSOFT\WINDOWS KITS\8.1\DESKTOP SDK\
Extension will not be loaded because an extension with the same ID 'Microsoft.WinJS' is already loaded at
C:\PROGRAM FILES (X86)\MICROSOFT SDKS\WINDOWS\V8.1\EXTENSIONSDKS\MICROSOFT.WINJS.SHARED\VSIX\
C:\PROGRAM FILES (X86)\MICROSOFT SDKS\WINDOWS\V8.0\EXTENSIONSDKS\MICROSOFT.WINJS.SHARED\VSIX\
It looks like it's trying to load two extensions but with different versions. I believe they are the Microsoft Advertising SDK for Windows 8.1 and Microsoft Advertising SDK for Windows Phone 8.1 but even if I launch VS 2012 with Admin, the Uninstall button is greyed out for me. I don't see them in the Add/Remove Programs either. So how can I get rid of this error?
A side note, I have both VS 2012 and VS 2013 installed and I had to do a repair on VS 2012 after VS 2013 was installed.
I had the same problem with Microsoft Windows Development Kit: two errors every time at Visual Studio start with description in the
%AppData%\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml
Sometimes (I think every time) Visual Studio Updater or Installer (when you try to install other version of VS) does not remove already installed version of a VS module.
In my case I had the second WDK with older version but installed after the newer one. I manually uninstalled the older version of Microsoft Windows Development Kit and problem with Visual Studio was solved.

How to build with v90 platform toolset in VS2012 without VS2008, using Windows SDK?

I use Visual Studio 2012 and this is the only version of Visual Studio I have installed. I need to build certain C++ projects with the v90 platform toolset (of Visual Studio 2008), but I can't install Visual Studio 2008.
I understand it is possible to use the v90 platform toolset by installing Windows SDK 7.0. How exactly is it done? If I simply use the web installer of 7.0 SP1, I still don't see v90 as one of the possible platform toolsets.
It is possible, but apparently requires some maneuvering and will not support building MFC applications. The following assumes that VS2012 update 4 is installed, but neither VS2010 nor VS2008 are installed.
Download the x86 DVD of SDK 7.0 SP1 (GRMSDK_EN_DVD.iso). Mount the ISO or extract its contents, and manually install the MSI files from the following folders under the Setup folder:
WinSDK (this may fail, it's ok)
WinSDKBuild
WinSDKInterop
WinSDKTools
WinSDKWin32Tools
vc_stdx86
vc_stdamd64
winsdk_intellidocs
WinSDKIntellisenceRefAssys
WinSDKNetFxTools
Download the x86 DVD of SDK 7.1 (GRMSDK_EN_DVD.iso). Mount the ISO or extract its contents, and manually install the MSI files from the same folders listed above (except winsdk_intellidocs, which doesn't exist).
Go to C:\Program Files (x86)\Microsoft Visual Studio 9.0. Copy the following files from Common7\IDE to VC\bin:
msobj80.dll
mspdb80.dll
mspdbcore.dll
mspdbsrv.exe
Now you should be able to choose the v90 platform toolset in Visual Studio 2012 and build with it.
Explanations (and sources):
Individual MSI installation is based on the second workaround from this connect report.
The requirement for both 7.0 and 7.1 is based on this question (both VS2010 and VS2008 are required to use v90 in VS2012!). SDK 7.1 is not needed if you have VS2010.
DLL/EXE copying requirement is based on yet another question. If you do not copy them, you will see error MSB6006: "CL.exe" exited with code -1073741515.
In addition to this answer I want to add that
You can install SDK 7.0 simply by running setup, there is no problem with it.
You can install SDK 7.1 by running setup, if you remove Microsoft Visual C++ 2010 Redistributables first and fix following registry values:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client]
"Version"="4.0.30319"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full]
"Version"="4.0.30319"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Client]
"Version"="4.0.30319"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Full]
"Version"="4.0.30319"
You can (and probably should) restore these values to whatever they originally were after installation is complete.
Do not forget to install KB2519277 after this, it updates compilers in SDK 7.1 to SP1.
You don't need to copy any dll. MSBuild uses
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VC#ProductDir
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Setup\VC#ProductDir
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VS#ProductDir
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0\Setup\VS#ProductDir
to set up paths. It's probably wise to fix them to point to "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\" and "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\" as it might be useful elsewhere in build process.
Same goes for version 10.0 if you plan to use Windows7.1SDK toolset.
Use WindowsSdkVer.exe to set current SDK to 7.1 to defeat cryptic error in Microsoft.Cpp.x64.Targets(63,5) about missing unnamed required file. If the tool gives you error, then set these values manually:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows#CurrentInstallFolder
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows#CurrentInstallFolder
to point to newly installed SDK. The tool needs some registry keys from Visual Studio installation to work properly, but there are many and I'm not sure which are important.
Reboot. None of the above asks you to, but without reboot I got errors when trying to build a project.
As an aside, SDK7.1 adds v100 toolset, but it won't work, saying something about Could not find WindowsSDKDir variable from the registry. This is because v100 actually requires SDK7.0A which comes with Visual Studio 2010 and is not available separately. Windows7.1SDK toolset is the one which utilises VC2010 compilers if you need them.
Microsoft.Cpp.Win32.*.props files have a lot of relevant stuff if something fails in build system.
One addition/update for VS2013 to Yodans answer:
My working setup:
VS2013 has to use VS2010 libs
Using WinSDK 7.1 (Yodans 2.) build tools (v100) in VS2013
clean install, uninstalling everything mentioned in the sdk release notes (can be downloaded at http://www.microsoft.com/en-us/download/details.aspx?id=8279 under category Details)
Microsoft Windows SDK for Windows 7 (7.1) (the Windows SDK core-component files)
Application Verifier
Debugging Tools for Windows
Windows Performance Toolkit
Microsoft Help Viewer 1.0
Microsoft Visual C++ 2010 Redistributable
Microsoft Visual C++ 2010 Standard Edition
Additionally removed all .NET and VC++ related MS Software (not tested if necessary)
choosing Windows7.1SDK as Platform Toolset in VS2013
error MSB6006: "CL.exe" exited with code -1073741515
cl.exe uses msobj100.dll, mspdb100.dll, mspdbcore.dll and mspdbsrv.exe
Added to PATH C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
Build works and binary is usable ( So now its tested Yodan ;-) )
My mistake:
copied files in 7. above to C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin (Yodans 3.), believing this dir is in PATH, but it was not!
So better do as sugested by Yodan and tested by myself in 8. above
p.s. same answer is solving this problem:
Visual Studio 2013: CL.exe exited with code -1073741515

Installing PlatformToolset v110 without installing Visual Studio 2012

We have a Visual Studio solution that contains some VC++ projects, and we've currently upgraded to Visual Studio 2012 from VS2010. In the process we also lifted the VC++ projects to PlatformToolset v110.
On our build server (Jenkins), we would like to build this project with MsBuild without having to install VS2012. But I can't get it to work, and I think it's because the folder C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110 must be present.
This folder and its contents is created during installation of VS2012, but as far as I can tell it won't be included in either the Windows SDK 7.1 or Windows SDK 8.0?
Is there any other SDK or installation package that can help with this issue?
I know it's not really without installing Visual Studio 2012, but:
If licensing costs are the biggest driver perhaps the Express for Windows Desktop edition could be an alternative. You could keep the installation to the minimum required to support C++ builds.

Failure during conversion to COFF: file invalid or corrupt

When I try building just a simple program into VS2010, compiling succeeds yet when I try to build the solution it gives me this error:
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
What am I doing wrong?
I had this issue and I solved it with this thread
disable incremental linking, by going to
Project Properties
-> Configuration Properties
-> Linker (General)
-> Enable Incremental Linking -> "No (/INCREMENTAL:NO)"
This issue occurred after Visual Studio 2012 installation.
The issue resolved by replacing the cvtres.exe from VS2010 with the one from VS2012.
Thank you to "social.msdn"!
I had this issue after installing dotnetframework4.5.
Open path below:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" ( in 64 bits machine)
or
"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin" (in 32 bits machine)
In this path find file cvtres.exe and rename it to cvtres1.exe then compile your project again.
Had to install VS 2010 SP1 in order to get it to work again for myself. Lame microsoft.
Do you have Visual Studio 2012 installed as well? If so, 2012 stomps your 2010 IDE, possibly because of compatibility issues with .NET 4.5 and .NET 4.0.
See http://social.msdn.microsoft.com/Forums/da-DK/vssetup/thread/d10adba0-e082-494a-bb16-2bfc039faa80
I am using Visual Studio 2010.
This happened to me when I installed .NET 4.5.
Uninstall of .NET 4.5 and install of .NET 4.0 helped me and error messages disappeared.
If you have installed VS2012 as well, the old cvtres file will no longer work.
Try removing the file (I simply renamed):
C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\BIN\cvtres.exe
You can also debug using the /VERBOSE linker option in order to get more information regarding the linker error. There you should see an error message that the invoke to cvtres fails.
In my case it was just caused because there was not enough space on the disk for cvtres.exe to write the files it had to.
The error was preceded by this line
CVTRES : fatal error CVT1106: cannot write to file

Resources