C++ #include is not found

后端 未结 9 594

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?

相关标签:
9条回答
  • 2020-11-27 05:06

    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.

    0 讨论(0)
  • 2020-11-27 05:07

    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

    0 讨论(0)
  • 2020-11-27 05:09

    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.

    0 讨论(0)
  • 2020-11-27 05:15

    It is included with the Windows Driver Kit Version 7.1.0.

    0 讨论(0)
  • 2020-11-27 05:16

    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

    0 讨论(0)
  • 2020-11-27 05:18

    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
    
    0 讨论(0)
提交回复
热议问题