我有一个简单的CMake项目,并尝试使用柯南安装的spdlog库(版本1.5.0)。
但是在构建时出现以下错误:
undefined reference to `spdlog::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
我不确定问题是否来自于我的安装程序,柯南或spdlog库。 谁能帮我在哪里看?
我的本地设置: Ubuntu 19.04, QT创作者 Clang 9(在IDE和柯南中), 柯南1.24.0
答案 0 :(得分:2)
请首先从柯南文档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
然后再次进行“柯南安装”,然后构建。