将yaml-cpp与conan链接
Linking yaml-cpp with conan
我在我的conan文件yaml-cpp/0.6.3
中使用来自conan中心的yaml-cpp
以及其他依赖项。
其余的库链接正确,所以我的CMakeLists.txt
文件中一定缺少一些内容。(也许是一些额外的定义…?(
到目前为止,这些线路:
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
set(CMAKE_CXX_STANDARD 20)
它运行良好(对于其他库,如bullet、glm…(
在链接时,出现了缺少实现的问题:
cmake --build build --config Debug --target all -- -j 10
/usr/bin/ld: CMakeFiles/my-project.dir/src/MySourceFile.cpp.o: in function `YAML::Node::Scalar[abi:cxx11]() const':
/home/my-user/.conan/data/yaml-cpp/0.6.3/_/_/package/82ef5eac51c38971dea2fd342dd55ddf2ddfbbc3/include/yaml-cpp/node/impl.h:169: undefined reference to `YAML::detail::node_data::empty_scalar[abi:cxx11]()'
/usr/bin/ld: CMakeFiles/my-project.dir/src/MySource.cpp.o: in function `tojson::loadyaml(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/my-user/my-project/lib/nlohmann/tojson.hpp:162: undefined reference to `YAML::LoadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
问题似乎是YAML::LoadFile
似乎未定义。
(我也试过在没有tojson
的情况下使用它(
YAML::Node test = YAML::LoadFile("test.yaml");
包还可以,但您的配置文件配置错误。
对`YAML::LoadFile(std::__cxx11::basic_string<char,std::char_traits,std:;分配器>const&('的未定义引用collect2:错误:ld返回1退出状态
您必须更新您的libcxx设置:
conan profile update settings.compiler.libcxx=libstdc++11 default
更多信息:https://docs.conan.io/en/latest/howtos/manage_gcc_abi.html
相关文章:
- lambda参数转换为constexpr技巧,然后获取带链接的数组
- CMake-按正确顺序将项目与C运行时对象文件链接
- 从链接列表c++中删除一个项目
- 有根的二进制搜索树.保留与其父级的链接
- 读取文件的最后一行并输入到链接列表时出错
- 静态数据成员的问题-修复链接错误会导致编译器错误
- node-gyp 在 macOS 上未正确链接库
- 基于boost的程序的静态链接——zlib问题
- 无法链接 CMake 中的本地库
- 内联函数中具有内部链接的全局变量
- 链接阶段在Ubuntu上失败,但在MacOS上失败
- 使用gcc从静态链接的文件中查找可选符号
- 我可以将一个用clang c++11编译的对象与另一个用c++17编译的对象链接起来吗
- 将--whole archive链接器选项与CMake和具有其他库依赖项的库一起使用
- 下面是我为检测链接列表中的循环而制作的代码
- 有了gcc,是否可以链接库,但前提是它存在
- 使用C链接在函数内部创建C++模板
- Visual Studio mkl_link_tool.exe链接错误
- 尝试链接我的着色器时,我收到错误代码"error c5145 must write to gl_position"
- 有人能帮我处理这个链接列表吗?C++