gtest installed with conan: undefined reference to `testing::internal::GetBoolAssertionFailureMessage`

一笑奈何 提交于 2019-12-01 09:36:00

The issue is that you are installing conan dependencies using the default settings (which is build type Release):

$ conan install --build=missing
# equivalent to
$ conan install -s build_type=Release ... --build=missing

The default settings can be seen in your conan.conf file

Then, you are using cmake in a nix system with the default build type which is Debug, which is a single-conf environment (opposed to multi-configuration Debug/Release environments, as Visual Studio), so when you are doing:

$ cmake .. && cmake --build .
# equivalent to
$ cmake .. -DCMAKE_BUILD_TYPE=Debug && cmake --build .

The incompatibility of Debug/Release build leads to that unresolved issue. So the solution would be to use the same build type that matches your installed dependencies:

$ cmake .. -DCMAKE_BUILD_TYPE=Release && cmake --build .

If using multi-configuration environments like Visual Studio, the correct way would be:

$ cmake .. && cmake --build . --config Release
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!