2

I have a simple CMake project and try to use the spdlog library (version 1.5.0) installed by conan.

But when building I get the following error:

undefined reference to `spdlog::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'

I'm not sure if the problem comes from my setup, conan or the spdlog library. Can anyone help me where to look?

My local setup: Ubuntu 19.04, QT Creator, Clang 9 (in the IDE and conan), conan 1.24.0

1 Answer 1

8

Please start first with the "Getting Started" from the Conan docs https://docs.conan.io/en/latest/getting_started.html, make sure it works, and then, start from there to do your own examples.

In the getting started you will have an example of consuming existing libraries in ConanCenter. There is also a prominent "Important" notice that says:

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

Basically the default auto-detected profile is using libstdc++, while your compiler is mostly likely using libstdc++11. You need to change the default profile with:

$ conan profile update settings.compiler.libcxx=libstdc++11 default

And then do "conan install" again, and build.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, for the detailed description :) It was indeed the compiler setting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.