48

When I compile my C++ program in Visual Studio Express it says that it can't find atlbase.h. Am I missing some SDK or something?

Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
Ramilol
  • 3,394
  • 11
  • 52
  • 84
  • 5
    As Matteo alluded to, ATL is not included with the Express edition. – C. K. Young Oct 09 '10 at 23:24
  • 2
    ATL is now a part of build tools https://blogs.msdn.microsoft.com/vcblog/2016/03/31/announcing-the-official-release-of-the-visual-c-build-tools-2015/ – pronebird Feb 03 '18 at 21:40
  • @highmaintenance The page is not found. – Stevoisiak Mar 11 '19 at 14:11
  • @StevenM.Vascellaro: it was https://devblogs.microsoft.com/cppblog/announcing-visual-c-build-tools-2015-standalone-c-tools-for-build-environments/ "MFC and ATL (added with VS 2015 Update 3)" – Roman R. Mar 11 '19 at 14:18
  • Related: [MFC development in vs2017](https://stackoverflow.com/q/43074045/3357935) – Stevoisiak Mar 11 '19 at 15:42
  • 1
    @StevenM.Vascellaro See the wayback machine https://web.archive.org/web/20190117225943/https://blogs.msdn.microsoft.com/vcblog/2016/03/31/announcing-the-official-release-of-the-visual-c-build-tools-2015/ – pronebird Mar 12 '19 at 21:01

10 Answers10

68

Visual Studio 2017

When running the Visual Studio Installer, select the Individual components tab, and under SDKs, libraries, and frameworks make sure Visual C++ ATL Support is selected. VS Installer Visual C++ ATL Support selected

KymikoLoco
  • 1,433
  • 1
  • 15
  • 17
  • 1
    I did the above but it didn't end up on the path so I added it. For me, it was: D:\Visual Studio 2017\VC\Tools\MSVC\14.11.25503\atlmfc\include – Colby Africa Oct 26 '17 at 23:39
  • 1
    Between the highlighted with yellow there also is "MFC and ATL support (x86 and x64)" item, which might need to be checked as well. – Roman R. Dec 14 '17 at 08:44
  • 1
    Installing ATL didn't fix the issue in Visual Studio Community 2017. This may only work in VS Professional. – Stevoisiak Mar 11 '19 at 14:26
  • 4
    The same is available for VS 19, both for the v141 (VS 17) and v142 (VS 19) toolchains. – jciloa Dec 12 '19 at 09:00
  • 1
    @StevoisiaksupportsMonica this works for Visual Studio 2017 Express, which is in the OP's question. But this is incomplete. First of all you install Visual Studio 2017 BuildTools and select Visual C++ ATL for x64. Then you go into the directory and copy `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\atlmfc` to VSDExpress folder `C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023`. Then the tools can find the source files. See @pogosama's answer. – 1283822 Dec 12 '19 at 22:28
40

It is included with the Windows Driver Kit Version 7.1.0.

Bernhard Wally
  • 409
  • 1
  • 4
  • 2
  • 2
    I have just used this solution. By far the best answer. For some reason I had to download the ISO, though, but hosted that with Daemon Tools and no problems installing it. Not only does it give you the header (`atlbase.h`) and libs (e.g. `atls.lib`), the next missing lib I needed was `ws2_32.lib` and it was also included with a whole host of others. Don't bother with the old SDKs, and you certainly don't need to upgrade your Express Visual Studio edition as so many people suggest at first. – Cookie Feb 29 '12 at 17:41
  • 1
    I have downloaded this driver kit but couldn't figure out how to give path of atlbase.h in project. Asked a question [here](http://stackoverflow.com/questions/32906033/including-files-or-headers-outside-the-windows-kit) also. – Bilal Haider Oct 02 '15 at 11:54
16

Microsoft ATL (Active Template Library), which includes the header atlbase.h is included with the Windows 2003 SDK, but it is not included with any newer Windows SDK release. It is also included with Professional editions of Visual Studio.

wkl
  • 77,184
  • 16
  • 165
  • 176
  • which one of the three files should i download – Ramilol Oct 09 '10 at 23:24
  • 2
    `PSDK-amd64.exe` if you are running 64-bit Windows on an x86-64 CPU. `PSDK-ia64.exe` if you are running Windows on Itanium. `PSDK-x86.exe` if you are running 32-bit Windows. – wkl Oct 09 '10 at 23:28
  • 3
    Well, link doesn't exist anymore. [This](http://stackoverflow.com/a/8990680/353410) seems to work – Dr. belisarius Oct 09 '14 at 10:18
6

Solution for Visual Studio 2017 Express edition

I had the same error when building a COM C++ project in Visual Studio 2017 Express edition. As mentioned by several users here, ATL support is not included with the Express edition of Visual Studio. So to build a C++ COM/ATL project you need at least the Community edition.

If you really need to use the Express edition, you can download and install the Build Tools for Visual Studio 2017. Make sure to enable the 'Visual C++ ATL for x86 and x64' component during the setup.

After that add additional VC++ directories in the project properties:

  • Include directories: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\atlmfc\include
  • Library directories: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\atlmfc\lib\x86

The VC++ compiler should now be able to find the ATL source and library files.

pogosama
  • 1,818
  • 1
  • 24
  • 29
5

For users of Visual Studio 2015, ensure Common Tools for C++ is installed (part of the VS installer).

user145400
  • 1,076
  • 1
  • 12
  • 27
3

Situation

With Visual Studio 2017 Community Edition, we installed "Visual C++ ATL support" and MFC and ATL support. The error still occurred in our x64 project.

Solution

We fixed some paths with the following two commands:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>mklink /d atlmfc "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\atlmfc"
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\atlmfc\lib>mklink /d amd64 "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\atlmfc\lib\x64

Details

We eventually found the header atlbase.h in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\atlmfc\include. This path simply was not added to the VC Include directory by vsvars32.bat, so the header was not found during build.

vsvars32.bat includes the following line:

@if exist "%VCINSTALLDIR%ATLMFC\INCLUDE" set INCLUDE=%VCINSTALLDIR%ATLMFC\INCLUDE;%INCLUDE%`.

This resolved to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include in our machine.

We created a directory junction, so the build tool finds atlbase.h in the expected directory (this is the first command from the Solution section above):

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>mklink /d atlmfc "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\atlmfc"

Afterwards, the linker did not find atls.lib (see Cannot Open File atls.lib). This was due to the expected file structure was that lib should directly contain the x86 version of the libs and lib\amd64 should contain the x64 variants. Instead, lib\x86 contained the x86 versions and lib\x64 contained the 64 bit versions. Since we build a 64 bit project, creating another directory junk from amd64 to x64 solved the problem:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\atlmfc\lib>mklink /d amd64 "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\atlmfc\lib\x64
Jules Dupont
  • 7,259
  • 7
  • 39
  • 39
Froggy
  • 339
  • 2
  • 15
  • This method didn't survive the latest Visual Studio update, as the ATL SDK updated to 14.14.26428 and so the paths changed. After updating the symlink paths, it worked again. – Froggy May 08 '18 at 09:51
2

That header appears to be a part of the Windows Platform SDK.

You should search your computer for the file. That will tell you if you're missing it.

Drew Dormann
  • 59,987
  • 13
  • 123
  • 180
  • It was included in older versions of the Windows Platform SDK, but it is (apparently intentionally) omitted from current ones. – jamesdlin Oct 10 '10 at 00:13
  • atlbase.h file only come up with community edition , trying to download from other SDK is waste of time , because all other SDK links are not found. Is it correct? – Jon marsh Sep 18 '19 at 11:10
  • For me, Visual Studio (2022) Tools->'Get Tools and Features' did it. – Epirocks Sep 29 '22 at 13:41
1

I had same problem with sample project. I specified the sample project's properties and the sample project compiled successfully.

Visual Studio 8
For header
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include

For .lib file
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib

joce
  • 9,624
  • 19
  • 56
  • 74
1

I have not yet seen anyone mention Visual Studio 2015 (MSBuild 14.0). In this case I've had to download Visual C++ BuildTools (found here: https://visualstudio.microsoft.com/vs/older-downloads/). After having installed this, running the installer again allowed me to modify the installation and include the ATL libs.

Hope this helps anyone that is still using MSBuild 14.0

Marty
  • 539
  • 5
  • 6
0

update for visual studio community 2022:

  1. open visual studio installer.

    you can search it on start

  2. modify installed version

enter image description here

  1. search atl and install.

    if you are not sure about the version, go to install directory to check it.

    for example my directory has 14.33, so I choose v14.33, if there are multiple versions, install them all, or you can try one by one.

    D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629

enter image description here

andrewchan2022
  • 4,953
  • 45
  • 48