[英]Why can't I link to spdlog library installed with conan
我有一个简单的 CMake 项目,并尝试使用柯南安装的 spdlog 库(版本 1.5.0)。
但是在构建时出现以下错误:
undefined reference to `spdlog::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
我不确定问题是来自我的设置、conan 还是 spdlog 库。 谁能帮我在哪里看?
My local setup: Ubuntu 19.04, QT Creator, Clang 9 (in the IDE and conan), conan 1.24.0
请首先从柯南文档https://docs.conan.io/en/latest/getting_started.html中的“入门”开始,确保它有效,然后从那里开始做你自己的例子。
在入门中,您将有一个使用 ConanCenter 中现有库的示例。 还有一个突出的“重要”通知说:
If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. You can change this with the following commands:
$ conan profile new default --detect # Generates default profile detecting GCC and sets old ABI
$ conan profile update settings.compiler.libcxx=libstdc++11 default # Sets libcxx to C++11 ABI
基本上默认的自动检测配置文件使用 libstdc++,而您的编译器很可能使用 libstdc++11。 您需要更改默认配置文件:
$ conan profile update settings.compiler.libcxx=libstdc++11 default
然后再次执行“conan install”,然后构建。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.