gpt4 book ai didi

c++ - 使用 gcc 编译和使用 clang 编译代码时 undefined reference

转载 作者:行者123 更新时间:2023-11-30 05:15:57 25 4
gpt4 key购买 nike

我有两个项目

  1. 第一个项目用clang编译
  2. 第二个项目是用gcc编译的,使用了第一个项目的代码

第二个项目因对具有类型特征的函数的 undefined reference 错误而失败:

CMakeFiles/RobotAPICore.dir/remoterobot/RobotStateObserver.cpp.o: In function      
`RobotStateObserver::udpatePoseDatafields(std::map<std::string, IceInternal::Handle<FramedPoseBase>, std::less<std::string>, std::allocator<std::pair<std::string const,
IceInternal::Handle<FramedPoseBase> > > > const&)':
/home/user/RobotAPI/source/RobotAPI/libraries/core/remoterobot/RobotStateObserver.cpp:149:
undefined reference to `Variant::Variant<float>(float const&, boost::disable_if_c<boost::is_base_of<VariantDataClass, float>::value||boost::is_pointer<float>::value, void>::type*)'

如果我使用相同的编译器编译这两个项目,一切正常。

有什么想法吗?

谢谢!

最佳答案

是的,你不能那样做。

不要混合使用工具链。

关于c++ - 使用 gcc 编译和使用 clang 编译代码时 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42886408/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com