I am swapping machines (between two Windows 8.1 laptops) and have just loaded the project I'm working on from TFS. On one machine it compiles, on the other it does not and gives the first error
error C1083: Cannot open include file: 'atlbase.h': No such file or directory
On both laptops I am running Visual Studio Ultimate 2013. On the first laptop I've checked to see where it is picking up atlbase.h
and it is from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include
i.e. from the Visual Studio 2012 installation directory. On the new machine I do not have Visual Studio 2012 installed so the directory C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include
does not exist.
Other people have similar problems (e.g. Ramilol's question) because they are using Visual Studio Express. I am using Ultimate.
It could be an environment variables problem (as suggested by raj raj) but my include directory paths under VC++ Directories
are $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath)
as required.
My general question is "how do I fix this?" but I'd also be interested to know how I check and set the value of $(VCInstallDir) since C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include
does have atlbase.h
in (so I am flummoxed as to why it is not picked up).
========== EDIT 1: Rewording ==========
Let me have another go at wording this question.
I have loaded a Visual Studio 2013 project onto a new build laptop from TFS. It will not build and gives errors like error C1083: Cannot open include file: 'atlbase.h': No such file or directory
. The file atlbase.h
is present on the new machine, in the directory C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include
.
In my project's properties my include directory paths under VC++ Directories
are $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath)
How do I check what those macros are set to, and if they are not where atlbase.h
is (i.e. C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include
) how do I fix that?
========== EDIT 2: Microsoft Visual C++ Redistributables installed ==========
Responding to jp2code's answer the machine that works and the one that does not have a similar array of Microsoft Visual C++ Redistributables installed as the following screenshot shows (the working machine's on the left):
========== EDIT 3: Environment variables ==========
In his answer, pje explains how to look up the environment variables. %VCInstallDir%
is correctly set to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\
But if I right click on the line #include <atlbase.h>
I get this error which suggests that despite %VCInstallDir%
being correct, that is not where VS is looking:
========== EDIT 4: Platform toolkit setting ==========
Another possibility is the Configuration Properties | General | Platform Toolset
project setting, suggested by manuell in the comments and Michael Burr in his answer. For the project it is set to set to Visual Studio 2012 (v110)
but the only other option listed in the drop-down is v110_wp80
, which, when selected, becomes Windows Phone 8.0 (v110)
. If I hand edit the .vcxproj file in notepad and reopening the project in Visual Studio Ultimate 2013 the property page now lists the Platform Toolset as Visual Studio 2013 (v120) (not installed)
.
If I start a new C++ Windows Store project I can set Platform Toolset to Visual Studio 2013 (v120)
without issue, in fact it is the only option listed in the drop-down. (N.B. The new project has Target Platform Version
set to 'Windows 8.1', and it is greyed out, so I cannot change it, while the failing project has it set to Windows 8.)
========== EDIT 5: Entire project settings file ==========
In the comments Michael suggests that "maybe posting the .vcxproj somewhere (like as a gist on github) might be helpful". I have posted it here.
========== EDIT 6: Uninstalling and reinstalling Visual Studio 2013 Ultimate ==========
Has no effect, the same error recurs.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include
, exactly where one might expect them. But that's not where Visual Studio is looking for them. I suspect it is looking forC:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include
which does not exist on the second machine because I only have Visual Studio 2013 installed on that machine. – Bookstand.vcxproj
somewhere (like as a gist on github) might be helpful. – TerisateriyakiVisual Studio 2013 (v120) (not installed)
and gave a compiler error (though it is a different error: "error X5608: Compiled shader code uses too many arithmetic instruction slots (122)"). – Bookstand