当我尝试使用标志编译我的eek.cpp
文件时,它显示:g++ eek.cpp -o eek -fsanitize=undefined
ld: library not found for -lubsan
collect2: error: ld returned 1 exit status
但g++ eek.cpp -o eek
工作正常。
我的终端截图在这里。
我在 macOS Big Sur 上使用 zsh 和 gcc 10.2.0。fsanitize=undefined
在我从 Catalina 更新我的 macOS 之前,昨天还在工作。
该ubsan.h
文件确实存在于 中/usr/local/Cellar/gcc/10.2.0_2/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0/plugin/include
,但它不起作用。我也读过这篇文章,但它并没有解决我的问题。我应该如何解决它?