LINK : fatal error LNK1104: cannot open file 'clang_rt.asan_dynamic_runtime_thunk-x86_64.lib'

Viewed 927

I'm trying to compile with the C++ address sanitizer (project property pages / C/C++ / Enable Address Sanitizer = YES), but I'm receiving the following error on compiling:

LINK : fatal error LNK1104: cannot open file 'clang_rt.asan_dynamic_runtime_thunk-x86_64.lib'
2 Answers

First you should make sure you installed the Address Sanitizer as described here

Once you installed it, the library should be in your MSVC directory, it's different depending on the Visual Studio version you installed.

After you found the file, add it's folders path to the project Linker:

in Solution explorer Right click on

Project > Properties > Linker > Additional Library Directories > Edit... > New line

Recompile, now the .lib file should be available if you compile with /fsanitize=address option.

Go to your project properties, and under VC++ Directories / Library Directories, add an entry:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\lib\x64

Make sure the directory exists! In particular, note the Visual Studio build number (14.29.30133) is being used in the path, so check if yours is different.

Related