【发布时间】:2018-12-01 12:13:23
【问题描述】:
我在 windows 和 linux 中使用 clang 7 来生成 c++ 项目的覆盖率。 在 linux 中,我可以通过添加编译标志成功地生成所有覆盖信息:
-fprofile-instr-generate -fcoverage-mapping
但在 Windows 中,它返回链接器错误,并且 llvm 安装目录中不存在 llvm-cov...
所以我猜clang 不支持Windows 中的代码覆盖?是这样吗?
(如果不能,你能告诉我我在链接阶段缺少什么吗?)
PS:链接器错误来自:
lld-link.exe: error: duplicate symbol: __profn_??_GTestFactoryBase@internal@testing@@UEAAPEAXI@Z
到:
lld-link.exe: error: undefined symbol: __llvm_profile_runtime
>>> referenced by src\app\CMakeFiles\app.dir\main.cpp.obj:(__llvm_profile_runtime_user)
lld-link.exe: error: undefined symbol: __llvm_profile_register_function
>>> referenced by src\app\CMakeFiles\app.dir\main.cpp.obj:(__llvm_profile_register_functions)
>>> referenced by src\app\CMakeFiles\app.dir\main.cpp.obj:(__llvm_profile_register_functions)
PS:我正在使用 Visual Studio 构建工具在 windows 中使用 clang 进行编译。
PS2:根据我的阅读,我们还需要将“-fprofile-instr-generate”传递给链接器......但不知道应该如何完成......
谢谢
【问题讨论】:
标签: c++ windows clang llvm-clang visual-studio-2017-build-tools