Visual Studio 2012 using platform toolset v100. Cannot open source file "atlbase.h" - c++

I am using Visual Studio Ultimate 2012. I have a project that works when i use the default v110 platform toolset.
Now I would like to add the Point Cloud Library (PCL) to this project to further work on it. Unfortunately there are only binaries available for Visual Studio 2010. I first tried to compile the 2012 binaries myself but that turned out to be more trouble than its worth. So i changed my platform toolset to v100 in order to use the PCL prebuilt binaries.
However, when doing so, one of my includes (atlbase.h) is no longer recognized. I have tried to manually include this by adding the Include and Library Directories of ATL in the project properties. This generated a whole lot of new errors, originating from the atl header files, which seems odd. I have also tried changing the option "Use of ATL" to "Dynamic Link to ATL" and "Static Link to ATL" from the default "Not Using ATL" to no avail.
I'm working on a 64 bit Windows 7 Ultimate machine and want to compile in 32 bit.
Edit: Using Process Monitor I have found that Visual Studio is looking for the include file in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlbase.h.
This folder (..\atlmfc) does not exist.
My VS2012 is installed at D:\School Programs\Visual Studio 2012
Is there a fix for this?

When you Switch to another different toolset this complete toolset must be available. This includes also the header files.
It should be possible without great Trouble to convert this DLL into VS 2012. Or myabe you can include the complete source without using a separate DLL.

Download and install WDK 7.1 (microsoft.com/en-us/download/confirmation.aspx?id=11800)
Create an environment variable which points to the installation directory, I called mine WINDDK
Go to project Properties -> VC++ Directories
Add $(WINDDK)\inc\atl71 to Include Directories
Add $(WINDDK)\lib\ATL\i386 to Library Directories (this is for 32 bit)
Go to project Properties -> Linker -> Input
Add atl.lib to Additional Dependencies
These steps have solved my problem

Related

Visual Studio 2017 can't find windows.h

Hell'o
I've just installed Visual Studio 2017 (enterprise).I opened my project whom I created in Visual Studio 2015. My project uses windows.h library but VS2017 cannot find this library. How to repair this?
My solution was :
Open the project properties
Into General --> SDK Version
I just picked the 10.0.15063.0 version instead of 8.1
And it worked.
I solved this issue by re-running the Visual Studio Installer and selecting the "Modify" button. Once presented with the Workloads screen I clicked on the "Individual Components" tab and selected all of the latest "Windows 10 SDK" Checkboxes(version 10.0.15063.0). My guess is that the entry for "Desktop C++ x86 and x64" is the one the actually fixes it but it is only speculation because none of those options were checked when I ran the installer and as you can see I checked all of them.
This happens when you have customized include/library paths in legacy projects. If you added your own additional paths in project properties, VisualStudio 2017 can't automatically figure out base paths when switching between platforms/toolsets - normally it automatically puts correct paths there, but if you added customizations, VS won't touch them.
This is legitimate problem which I ran into myself recently when migrating old project targeted for Windows XP into VS2017. None of the answers or comments listed/linked here so far are helpful. I have all legacy SDKs in VisualStudio 2017 installer, and none of that fixed VS not finding essential includes such as <windows.h>. In my case the project was using v120 toolset from VS2013, which is superseded by v140_xp in newer VS.
After setting correct platform and toolset understood by VS2017, I did the following to resolve the problem:
Open project properties, go to VC++ Directories, for 'Include Directories' and for 'Library Directories', choose <Inherit from parent or project defaults>. This will remove your additional paths.
Click 'Apply'. This will reset include path to something like $(VC_IncludePath_x86);$(WindowsSdk_71A_IncludePath_x86) (will vary for SDKs).
Re-add your extra paths here, or better yet - under C/C++/General -> Additional Include Directories and Linker/General -> Additional Library Directories.
I got it fixed when I simply changed "General => Windows SDK version" to a different version, submitted the changes and then changed it back.
The problem occurs when you migrate your C++ project from a more updated visual studio version to a lesser one.
To solve the issue simply go to your :
Project's properties-->General-->SDK Version [and here unroll to show installed SDK versions so you downgrade to an available version {Since the required one seems unavailable hence the error}].
Once one of the Available SDKs selected, Apply, and go back to your code, and everything gonna get fixed.
If the installation was ok it should be here:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um\Windows.h
So be sure it is on the include path of the project properties.
Or if you prefer by manual edit in the .vcxproj file at the IncludePath Tag line:
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared;</IncludePath>
TL;DR: make sure the checkbox, marked below, is checked.
In the Include Directories Dlgbox, there's an option at the bottom "Inherit from..." that needs to be checked. Somehow it got unchecked after moving a project to a different solution.
So, in my case, resetting to defaults and adding custom paths again wasn't even needed.
You have to go in Visual Studio 2017 Installer, choose Individual Components, and manually select and install Windows 8.1 SDK.
This step work for me.
1. Open visual studio installer
2. at menu "Visual studio comunity 2017" --> click modify
3. at desktop development with c++ --> enable windows10 SDK for desktop and windows 8.1 SDK
4. click modify
I've also installed Visual Studio 2017 (community) first with the default composition settings.I opened my project whom I created in Visual Studio 2015. My project uses windows.h library but VS2017 cannot find this library and other problems. At first I install the missing (SDK 10 ... etc.) components. Part of problems is gone, but windows.h still not found. The problem was solved by completely uninstalling VS2017 and then installing with all the options at once.
My solution was checking paths.
Include Directories:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;
%(AdditionalIncludeDirectories)
Library Directories:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64
and then right click Solution Explorer: Solution 'xxxxx' (1 project) line click "Retarget solution"
Remember to set Debug setting for Symbols fetch - Windows 10 must use Microsoft symbol server!

How to fix error MSVCP120D.dll in Visual Studio 2015?

Hello I have downloaded and unzipped OpenCV-2.4.10.exe on my PC. Then created a new Win32 Console application project in VS 2015, set all the Paths in Project properties, set the environmental variables in Win8.1. When I'm trying to start the program in debugging mode I get the "The program can't start because MSVCP120D.dll is missing from your computer. Try reinstalling the program to fix this problem".
Then, I downloaded the Visual C++ redistributable for Visual Studio 2015 But the problem still remains. What should I do to use OpenCV in VS 2015?
OpenCV-2.4.10.exe comes with runtime binary dlls built to work with runtimes from vc10 (vs2010), vc11 (vs2012) and vc12 (vs2013).
These DLL files use MSVCP100.dll, MSVCP110.dll and MSVCP120.dll respectively, and if you have installed Visual Studio 2015 you should find them in your System32 (or SysWOW64) directory.
The MSVCP120D.dll error appears when your application tries to load the DEBUG version of the DLL binaries. You do not have MSVCP120D.dll unless you have Visual Studio 2013 installed on your system. To solve this problem, use the Release runtime instead of the Debug runtime.
All you need to do is exclude the DEBUG lib files from your project. This means including only the lib files without the suffix 'd'. (ie. include opencv_core2410.lib instead of opencv_core2410d.lib)
HTH
Extras:
You don't really need to load the Debug binaries, unless you need to debug openCV's source code. If you do, there's still a way. Download the openCV source code, use CMake to create a VS2015 project. You can then build your own dll binaries using the latest runtime from VS2015.
VS2015 uses vc14 while OpenCV2.4.10 doesn't come with pre-built binaries associated with vc14. This answer should help you to understand. Accordingly you should choose the right folder (vc14) for Linker>General>Additional Library Directories in project properties.
You can use cmake to build binaries using VS2015 or you can download a later version of OpenCV which has prebuilt binaries for vc14.

Linker error after upgrading solution to VS2012

I was developing a project that uses (among others) boost::filesystem under VS2010. Today I decided to switch to VS2012, upgraded the solution (just let the VS do it automatically) and when I tried to compile it seems all went fine except for 1 thing:
fatal error LNK1104: cannot open file 'libboost_filesystem-vc100-mt-gd-1_53.lib'
I keep boost in a separate folder (outside the project location), the paths seems to be correct (I have precompiled *.lib files of boost, both for VS2010 and VS2012). The error suggests the project looks for the old versions of libs (vc100 instead of vc110) but I have no idea how to change that.
Make sure the Platform Toolset option is set to v110. Right click on the project name and select Properties. Then under Configuration Properties -> General -> Platform Toolset select Visual Studio 2012 (v110).

Is there a way to list library dependencies in Visual Studio?

I'm trying to build a C++ project with Boost and Cinder on Windows Server 2008 with MSBuild without success. I've build the same project on my Windows 7 machine under VS2013 and MSBuild, however on the server it is saying that it can't open a library by the name of "threadsafestatics.lib"
I've never heard of threadsafestatics.lib and my Google-foo hasn't brought me any luck finding anything about it online.
Is there a way to find out what part of my project is depending on this library?
Providing debug level output for the build process helped to work around the problem:
Tools->Options->Projects and Solutions->Build and Run->MSBuild project build output verbosity
threadsafestatics.lib is a new library from the November 2013 CTP. If you are compiling with the CTP, you must add its installed lib folder to Project > Properties > VC++ Directories > Library Directories.
If you installed the CTP to its default location on a 64-bit machine, the path is C:\Program Files (x86)\Microsoft Visual C++ Compiler Nov 2013 CTP\lib
You can also use the macros $(VC_CTP_Nov2013_LibraryPath_x86), $(VC_CTP_Nov2013_LibraryPath_x64), or $(VC_CTP_Nov2013_LibraryPath_ARM) depending on your target architecture.
If you had installed "CompilerCTP.Nov2013"Patch package, and using toolset of ctp2013,you can try to change toolset into 2013 with the following steps:
project -> property ->config property -> platform toolset ->Visual Studio 2013 (v120).

Fresh installation of VS 2012 will not build default console application: Missing SDKDDKVer.h (and stdio.h / CRT)

I have been using the trial version of VS 2012 Professional for about 1 month on my Windows 7 64-bit machine.
Today, I noticed that the Platform Toolset option (project properties) was set for Visual Studio 2010 (v100), which seemed odd, because I am running VS 2012. Changing the "Platform Toolset" to VS 2012 resulted in the error noted in the title of this question:
Cannot open include file: 'SDKDDKVer.h': No such file or directory
... while building stdafx.cpp (the error itself occurs in the file targetver.h).
A forum discussion I was browsing earlier hinted that the presence of VS 2010 during a VS 2012 install might have caused the problem. (I do not have links to those posts currently on hand.)
Because I have recently purchased VS 2012 Professional, I uninstalled the trial version of VS 2012, and then reinstalled a paid version VS 2012 (Professional) from a fresh download from the MSDN website. All told, the uninstall/reinstall required 2 hours or so.
During the reinstallation of VS 2012, I paid very close attention to all possible options, to see if any option might conceivably have caused the VS 2012 installer to "skip" the VS 2012 header files or other VS 2012 components, and use VS 2010 components instead. I could find no such option.
Reinstallation of VS 2012 was successful.
I created a new console project in a new workspace (note that my "recent projects list" still showed my recent VS 2012 projects, despite the uninstall/reinstall). The project settings for the new console project showed that the correct toolset was being used - Platform Toolset = Visual Studio 2012 (v110).
Unfortunately, building the out-of-the-box VS 2012 console application (including the precompiled header option, but no other option in the Create Project Wizard), results in exactly the same error:
Cannot open include file: 'SDKDDKVer.h': No such file or directory
What should I do?
.
ADDENDUM: Note for future readers; after changing path settings (see comments beneath answer, below) so that VS 2012 finds SDKDDKVer.h, it nonetheless fails to find stdio.h, a more serious problem because the VC11 version of stdio.h (as well as all the VC11 CRT headers) is not available on the machine anywhere.
Unfortunately, Microsoft has still not resolved these major bugs in their VS 2012 installation process. The only way I found to get a working VS 2012 installation including all VC11 CRT files is to:
Wipe your system completely clean of all MS products (this may be overkill, but I had to at least uninstall VS 2010 in addition to uninstalling VS 2012)
Remove the registry keys noted in the comments to the answer below (to be safe)
Delete residual directories (to be safe)
Restart (to be safe)
Install VS 2012 from scratch FROM THE .ISO, not the installer (assuming the installation files are downloaded from the MSDN site) (use a program like Power2Go to mount the .iso)
THEN, be absolutely sure to install VS 2012 Service Pack 1 (through "Windows Update" control panel) (without doing this step, the VC11 CRT headers are STILL not installed anywhere on the machine)
And finally, map the Windows SDK library directories as described in [this link](Link now points to a scam site, removed) (without doing this latter step, the linker fails to finde the path to the Windows kernel library)
... THEN there is a working installation of VS 2012.
Thanks alot, Microsoft.
After I set up Visual Studio 2013, I had same sdk error for a simple C++ code. I solve same problem with below steps:
Select Project Properties>Configuration>VC++ Directories>Include Directories and add that: c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
Select Project Properties>Configuration>VC++ Directories>Library Directories and add that: c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib
After that configuration I had problem about rc.exe link error. For this problem one more thing is needed:
copy RC.exe and RcDll.dll files from C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin and past them to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
After all those configuration steps, you can build a simple "Hello World!" example and run if you are lucky.
from MSDN forum:
Looking at the Include Directories for this project, I see the following
$(WindowsSdkDir)include
"WindowsSdkDir" is defined to be "C:\Program Files (x86)\Windows Kits\8.0\"
Unfortunately, the folder
"C:\Program Files (x86)\Windows Kits\8.0\Include\" doesn't actually
have any header files in it. Instead it contains three sub-folders.
One of these is the folder called "shared" which happens to contain
the "SDKDDKVer.h" file shown in the error message.
If this is your situation, replace $(WindowsSdkDir)include by the three folder names (at least $(WindowsSdkDir)include\shared) in your include path in your project properties under VC++ Directories.
To add this path permanently to VS2012, you'll need to make changes to the Microsoft.Cpp.Win32.user.props file under the C:\Users\xxx\AppData\Local\Microsoft\MSBuild\v4.0 folder (where xxx is your user name).
I had this problem with VS2013. Turns out when I separately installed Windows SDK 8.1 first, then Visual Studio 2013, it fixed the problem.
I should also note that I was installing this on a Windows 7 w SP 1 VM and at no point during the installation did it have a connection to the internet (I have read elsewhere some folks think an internet connection during install will fix the problem, but I was personally unable to verify that, and now that I have it working I'm not going to backtrack and test it).