Cannot Open File atls.lib
Asked Answered
S

8

18

I have atls.lib in my hard drive, but I can't link it into my Visual Studio project. I know that atls.lib is an ATL specific library file, and I have all the ATL files/headers/libraries. However, I still can't link them.

LINK : fatal error LNK1104: cannot open file 'atls.lib'

Can anyone help a helpless programmer?

Thank you very much.

Squally answered 20/6, 2012 at 15:37 Comment(0)
S
22

Fixed for me by installing the following Individual Component through the Visual Studio Installer:

  • C++ ATL for latest v142 build tools with Spectre Mitigations (x86 & x64)

I'm running a 32 bit C# project using VS2019.

Shift answered 9/9, 2020 at 16:9 Comment(2)
Thanks. You solution works. It is strange that the option "C++ ATL for latest v142 build tools (x86 & x64)" doesn't resolve the issue.Petrie
@Petrie it depends if /Qspectre option is set in your project or notItinerary
D
12

In my case the problem was missing ATL/MFC libraries for x64, I had to add them in the Visual Studio installer (it was an open source project, so I wasn't aware of the requirement).

Once again, the invaluable procmon did the job:
While atls.lib was found under $(VCInstallDir)atlmfc\lib the linker looked in $(VCInstallDir)atlmfc\lib\amd64.

Daryl answered 18/2, 2016 at 8:44 Comment(0)
K
10

Just to keep this question updated, I encountered this error after running the install for Spectre, the VC++ spec code mitigation tool. After looking at the VC++ directories, I noticed that both the Include Directories and the Library Directories have changed to add a "Spectre" addition to the path, while the original path to the actual file is no longer there. I will update this later after I figure out whether Spectre didn't install correctly, or if simply changing the path will solve the issue; I do NOT want the speculative attack exposed in my code, which apparently happens with ATL code.

EDIT

My compiler is VS 2017 Community Edition.

EDIT

The solution that worked for me is here, discovered by Holger Schmeken

Keto answered 13/3, 2019 at 15:0 Comment(1)
Thanks, basically we need spectre libs for ATL too!Lezlie
M
7

It seems that the library directory has not been added. In Project Properties, Linker, General options, add the directory where atls.lib resides to the Additional Library Directories field.

Miracidium answered 20/6, 2012 at 23:57 Comment(1)
I solved it. I was included the library, but was still getting the error. It solved mystically. However, now I get these errors. Care to have a look? Thank you.Squally
P
1

I added <Visual Studio folder\VC\Tools\MSVC\14.15.26726\atlmfc\lib\x64\atls.lib> to the Linker>Input> Additional Dependencies in solution properties and it got resolved.

Promptbook answered 27/11, 2018 at 21:5 Comment(2)
use the macro $(VCInstallDir). So its $(VCInstallDir)Tools\MSVC\14.15.26726\atlmfc\lib\x64\atls.libUnwept
In VS 2019, because it is a lib file, make sure you added to correct setting: right click on project, select properties, under Configuration Properties > VC++ Directories > Library Directories, add <Visual Studio 2019 folder>\Professional\VC\Tools\MSVC\14.24.28314\atlmfc\lib\x86Calvados
B
1

This issue started happening to me after a recent VS2019 update I got. I noticed that it was because Spectre Mitigation had been automatically enabled but I didn't have the Spectre Mitigation version of the library.

Installing the Spectre Mitigation version, or disabling Spectre Mitigation are both possible fixes.

Bes answered 28/4, 2020 at 19:8 Comment(0)
H
0

I have soloved this problem by just copying this file to my project folder.

Hetaera answered 26/9, 2018 at 1:46 Comment(0)
T
0

I'm using VS2017, I fix this issue by installing this component: Visual C++ ATL (x86/x64) with Spectre Mitigations

enter image description here

Talmud answered 7/3 at 3:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.