0
votes

I wrote a library that uses PCL and boost in C++. It is building perfectly. When I tried to make a wrapper for it using C++/CLR I got a lot of unresolved errors. Firstly, why Visual Studio is re-building my library again when building the wrapper? Secondly, why I got the following unresolved errors?:

Error   LNK2005 "protected: virtual void __cdecl pcl::Grabber::signalsChanged(void)" (?signalsChanged@Grabber@pcl@@MEAAXXZ) already defined in pcl_io_debug.lib(pcl_io_debug.dll)
Error   LNK2005 "protected: virtual void __cdecl pcl::Grabber::signalsChanged(void)" (?signalsChanged@Grabber@pcl@@MEAAXXZ) already defined in pcl_io_debug.lib(pcl_io_debug.dll)
Error   LNK2001 unresolved external symbol "public: virtual void __cdecl pcl::visualization::PCLVisualizer::FPSCallback::Execute(class vtkObject *,unsigned long,void *)" (?Execute@FPSCallback@PCLVisualizer@visualization@pcl@@UEAAXPEAVvtkObject@@KPEAX@Z)
Error   LNK2019 unresolved external symbol deflate referenced in function "protected: int __cdecl boost::iostreams::detail::zlib_base::xdeflate(int)" (?xdeflate@zlib_base@detail@iostreams@boost@@IEAAHH@Z)
Error   LNK2019 unresolved external symbol deflateEnd referenced in function "protected: void __cdecl boost::iostreams::detail::zlib_base::reset(bool,bool)" (?reset@zlib_base@detail@iostreams@boost@@IEAAX_N0@Z)
Error   LNK2019 unresolved external symbol inflate referenced in function "protected: int __cdecl boost::iostreams::detail::zlib_base::xinflate(int)" (?xinflate@zlib_base@detail@iostreams@boost@@IEAAHH@Z)
Error   LNK2019 unresolved external symbol inflateEnd referenced in function "protected: void __cdecl boost::iostreams::detail::zlib_base::reset(bool,bool)" (?reset@zlib_base@detail@iostreams@boost@@IEAAX_N0@Z)
Error   LNK2019 unresolved external symbol deflateReset referenced in function "protected: void __cdecl boost::iostreams::detail::zlib_base::reset(bool,bool)" (?reset@zlib_base@detail@iostreams@boost@@IEAAX_N0@Z)
Error   LNK2019 unresolved external symbol inflateReset referenced in function "protected: void __cdecl boost::iostreams::detail::zlib_base::reset(bool,bool)" (?reset@zlib_base@detail@iostreams@boost@@IEAAX_N0@Z)
Error   LNK2019 unresolved external symbol crc32 referenced in function "protected: void __cdecl boost::iostreams::detail::zlib_base::after(char const * &,char * &,bool)" (?after@zlib_base@detail@iostreams@boost@@IEAAXAEAPEBDAEAPEAD_N@Z)
Error   LNK2019 unresolved external symbol deflateInit2_ referenced in function "private: void __cdecl boost::iostreams::detail::zlib_base::do_init(struct boost::iostreams::zlib_params const &,bool,void * (__cdecl*)(void *,unsigned int,unsigned int),void (__cdecl*)(void *,void *),void *)" (?do_init@zlib_base@detail@iostreams@boost@@AEAAXAEBUzlib_params@34@_NP6APEAXPEAXII@ZP6AX22@Z2@Z)
Error   LNK2019 unresolved external symbol inflateInit2_ referenced in function "private: void __cdecl boost::iostreams::detail::zlib_base::do_init(struct boost::iostreams::zlib_params const &,bool,void * (__cdecl*)(void *,unsigned int,unsigned int),void (__cdecl*)(void *,void *),void *)" (?do_init@zlib_base@detail@iostreams@boost@@AEAAXAEBUzlib_params@34@_NP6APEAXPEAXII@ZP6AX22@Z2@Z)
2

2 Answers

1
votes

C++-CLI is a different language; it compiles to an entirely different target (some .NET runtime version/architecture), which is both why it builds again and why you need to configure the link dependencies for those target configurations.

I'd personally keep all native dependencies inside a native DLL and have a narrow interface implemented in a mixed-mode assembly. That way you can summarize the dependencies of the mixed-mode assembly as being the one native DLL that bundles any other native dependencies.

0
votes

Actually I have just used BOOST_IOSTREAMS_NO_LIB, and that fixed most of the problems. So it appeared to me that there is a problem in bzip2 filters in windows cause it should be disabled by default, and that disable them mostly. For other problem related to visualizer I found out the answer here