Search code examples
c++visual-studioatl

ATL headers missing when using the VC++ 2015 toolchain on Visual Studio 2017


I am using Visual Studio 2017 for a C++ project (created with VS 2015). I get the following error:

1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\afx.h(345): fatal error C1083: Cannot open include file: 'atltrace.h': No such file or directory

How can I install the ATL/MFC headers of the VS 2015 toolchain?

Details

  • "Platform Toolset" setting (at "Project properties/General/Platform Toolset")
    • set to "Visual Studio 2015 (v140),
    • changing the platform toolset to "Visual Studio 2017 (v141) compiles fine.
  • Files on disc
    • The include directory for VS 2015 (C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\) contains afx*.h files but no atl*.h files.
    • These missing files seem to belong to VC_ATL.Headers.msi ("Visual C++ Library ATL Headers Package") (which I checked on another machine with those files). I could not get the respective msi to install. (I took the msi from the other machine.) Error: "To install this product, please run Setup.exe. [...]".
    • The respective directory for VS 2017 (C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\atlmfc\include\) does contain those files.
  • Installer
    • "Windows Desktop Development with C++/VC++ 2015.3 v140 toolset for desktop (x86,x64)" is checked.
    • It seems to me that the v140 toolset is missing the ATL/MFC headers.
    • "Windows Desktop Development with C++/MFC and ATL support(x86 and x64)" does not seem relevant, it seems to be about the VS 2017 version.
  • VC++ redistributable seems irrelevant since those do not contain the header files.

Solution

  • There is a blog post about the Visual C++ Build Tools 2015. The build tools are also released in a standalone version without the need to install Visual Studio 2015:

    The Build Tools are the same C++ tools that you get with Visual Studio 2015 but they come in a scriptable standalone installer that only lays down the tools you need to build C++ projects.

    Microsoft has included ATL/MFC.

    They can be downloaded from http://landinghub.visualstudio.com/visual-cpp-build-tools - (archive.org link). Make sure to select "ATL and MFC" which is deselected by default.