本文介绍了C ++一起使用两个不兼容的库,有哪些选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用点云库(PCL)编写了一个程序.现在,我想使用一些cgal的算法.我已经设法隔离建立了一个cgal类(所有依赖项都在起作用,等等),但是当我尝试将两个项目结合在一起时,我得到了未解决的外部符号错误

I wrote a program using the point cloud library (PCL). Now I want to use some of cgal's algorithms. I've managed to build a cgal class in isolation (all dependencies working etc.) but when I try and combine the two projects I get unresolved external symbol errors

那么,构建cgal项目并从PCL项目中访问(以某种方式)我有什么选择?我会将一个简单的向量传递给cgal项目,因此从理论上讲,任何专业库都无需相互交互.我曾尝试将其构建到静态和动态库中,但据我所知,当我这样做时仍需要包括所有cgal依赖项-这又使事情变得混乱了.

So, what are my options for building a cgal project and accessing it (somehow) from my PCL project? I'd be passing a simple vector to the cgal project so in theory none of the specialist libraries have to interact with each other at all.I've tried building it into a static and dynamic library but as far as I know I still need to include all of the cgal dependencies when I do so -- this breaks things again.

有关未解决的外部因素的更多信息:

我使用此 CGAL示例使用CMAKE添加所需的依赖项:CGAL组件(包括QT),TAUCS,LAPACK,BLAS.该项目建设愉快.如果我添加对PCL库的引用:

I made a simple project (VS2010) using this CGAL example adding required dependencies using CMAKE: CGAL components (including QT), TAUCS, LAPACK, BLAS. The project builds happily. If I add references to the PCL library:

include_directories (${PCL_INCLUDE_DIRS})
link_directories    (${PCL_LIBRARY_DIRS} )
add_definitions     (${PCL_DEFINITIONS})

现在,当我尝试构建时,会出现四个未解决的外部问题:

Now when I try to build I get four unresolved externals:

poisson.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void * __cdecl boost::detail::get_tss_data(void const *)" (__imp_?get_tss_data@detail@boost@@YAPAXPBX@Z) referenced in function "public: class CGAL::Lazy<class CGAL::Point_3<struct CGAL::Simple_cartesian<class CGAL::Interval_nt<0> > >,class CGAL::Point_3<struct CGAL::Simple_cartesian<class CGAL::Gmpq> >,class CGAL::Gmpq,class CGAL::Cartesian_converter<struct CGAL::Simple_cartesian<class CGAL::Gmpq>,struct CGAL::Simple_cartesian<class CGAL::Interval_nt<0> >,struct CGAL::NT_converter<class CGAL::Gmpq,class CGAL::Interval_nt<0> > > > * __thiscall boost::thread_specific_ptr<class CGAL::Lazy<class CGAL::Point_3<struct CGAL::Simple_cartesian<class CGAL::Interval_nt<0> > >,class CGAL::Point_3<struct CGAL::Simple_cartesian<class CGAL::Gmpq> >,class CGAL::Gmpq,class CGAL::Cartesian_converter<struct CGAL::Simple_cartesian<class CGAL::Gmpq>,struct CGAL::Simple_cartesian<class CGAL::Interval_nt<0> >,struct CGAL::NT_converter<class CGAL::Gmpq,class CGAL::Interval_nt<0> > > > >::get(void)const " (?get@?$thread_specific_ptr@V?$Lazy@V?$Point_3@U?$Simple_cartesian@V?$Interval_nt@$0A@@CGAL@@@CGAL@@@CGAL@@V?$Point_3@U?$Simple_cartesian@VGmpq@CGAL@@@CGAL@@@2@VGmpq@2@V?$Cartesian_converter@U?$Simple_cartesian@VGmpq@CGAL@@@CGAL@@U?$Simple_cartesian@V?$Interval_nt@$0A@@CGAL@@@2@U?$NT_converter@VGmpq@CGAL@@V?$Interval_nt@$0A@@2@@2@@2@@CGAL@@@boost@@QBEPAV?$Lazy@V?$Point_3@U?$Simple_cartesian@V?$Interval_nt@$0A@@CGAL@@@CGAL@@@CGAL@@V?$Point_3@U?$Simple_cartesian@VGmpq@CGAL@@@CGAL@@@2@VGmpq@2@V?$Cartesian_converter@U?$Simple_cartesian@VGmpq@CGAL@@@CGAL@@U?$Simple_cartesian@V?$Interval_nt@$0A@@CGAL@@@2@U?$NT_converter@VGmpq@CGAL@@V?$Interval_nt@$0A@@2@@2@@2@@CGAL@@XZ)
poisson.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl boost::detail::set_tss_data(void const *,class boost::shared_ptr<struct boost::detail::tss_cleanup_function>,void *,bool)" (__imp_?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) referenced in function "public: void __thiscall boost::thread_specific_ptr<class CGAL::Lazy<class CGAL::Point_3<struct CGAL::Simple_cartesian<class CGAL::Interval_nt<0> > >,class CGAL::Point_3<struct CGAL::Simple_cartesian<class CGAL::Gmpq> >,class CGAL::Gmpq,class CGAL::Cartesian_converter<struct CGAL::Simple_cartesian<class CGAL::Gmpq>,struct CGAL::Simple_cartesian<class CGAL::Interval_nt<0> >,struct CGAL::NT_converter<class CGAL::Gmpq,class CGAL::Interval_nt<0> > > > >::reset(class CGAL::Lazy<class CGAL::Point_3<struct CGAL::Simple_cartesian<class CGAL::Interval_nt<0> > >,class CGAL::Point_3<struct CGAL::Simple_cartesian<class CGAL::Gmpq> >,class CGAL::Gmpq,class CGAL::Cartesian_converter<struct CGAL::Simple_cartesian<class CGAL::Gmpq>,struct CGAL::Simple_cartesian<class CGAL::Interval_nt<0> >,struct CGAL::NT_converter<class CGAL::Gmpq,class CGAL::Interval_nt<0> > > > *)" (?reset@?$thread_specific_ptr@V?$Lazy@V?$Point_3@U?$Simple_cartesian@V?$Interval_nt@$0A@@CGAL@@@CGAL@@@CGAL@@V?$Point_3@U?$Simple_cartesian@VGmpq@CGAL@@@CGAL@@@2@VGmpq@2@V?$Cartesian_converter@U?$Simple_cartesian@VGmpq@CGAL@@@CGAL@@U?$Simple_cartesian@V?$Interval_nt@$0A@@CGAL@@@2@U?$NT_converter@VGmpq@CGAL@@V?$Interval_nt@$0A@@2@@2@@2@@CGAL@@@boost@@QAEXPAV?$Lazy@V?$Point_3@U?$Simple_cartesian@V?$Interval_nt@$0A@@CGAL@@@CGAL@@@CGAL@@V?$Point_3@U?$Simple_cartesian@VGmpq@CGAL@@@CGAL@@@2@VGmpq@2@V?$Cartesian_converter@U?$Simple_cartesian@VGmpq@CGAL@@@CGAL@@U?$Simple_cartesian@V?$Interval_nt@$0A@@CGAL@@@2@U?$NT_converter@VGmpq@CGAL@@V?$Interval_nt@$0A@@2@@2@@2@@CGAL@@@Z)
poisson.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::system_category(void)" (__imp_?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "public: __thiscall boost::thread_exception::thread_exception(int,char const *)" (??0thread_exception@boost@@QAE@HPBD@Z)
poisson.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (__imp_?generic_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??__Eposix_category@system@boost@@YAXXZ)

过去我已经能够解决大多数问题,但是这些问题令我震惊,因此为什么我想知道我是否可以创建两个可以交互但不必共享不兼容库的项目.

I've been able to figure out most of these problems in the past but these blew my mind, hence why I wondered whether I could create two projects which interact but don't have to share libraries which aren't compatible.

推荐答案

OP在.

这篇关于C ++一起使用两个不兼容的库,有哪些选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-30 02:51