I am trying to use address sanitizer with MSVC.
Visual Studio Installer says I have "Visual Studio Community 2019" version 16.9.0.
I have the most basic C++ program:
int main() {
return 0;
}
The CMakeLists.txt is also very basic:
cmake_minimum_required(VERSION 3.14)
project(untitled VERSION 1.0.0)
add_executable(${PROJECT_NAME} main.cpp)
add_definitions(/fsanitize=address /Zi)
The program compiles and links correctly, both in debug and release mode. In release mode, I have the following warning, which seems perfectly legit:
LINK : warning LNK4302: please add '/DEBUG' to the link command line for better ASAN error reporting
So far, so good (?).
However, when I run the application, the return code is -1073741515 (0xC0000135). Google tells me this is likely to indicate a missing library.
If I remove add_definitions(/fsanitize=address /Zi) from the build, the return is 0. The missing library is very likely the address sanitizer itself.
How can I configure my system properly to solve this issue? Thanks!