How do I link PCL library properly for use within an objective-C app compiled in Xcode?

痞子三分冷 提交于 2019-12-04 17:31:59
andrew

Short answer:

Two Build settings under "Build Options":

C++ Language Dialect: GNU++98[-std=gnu++98]

C++ Standard Library: libstdc++ (GNU C++ standard library)

This second setting (C++ Standard Library) is the crucial one; Using libc++ will produce the "undefined symbols" linker errors shown in the question above.

Details for anyone trying this:

This works with Xcode 4.62, llvm4.2, libpcl 1.7 (currently dev, I compiled from trunk) and boost 1.53. Along the way I ran into a known issue with Boost and Cocoa involving the use of nil (see this link:https://svn.boost.org/trac/boost/ticket/5010) and also some strangeness with boost traits (see this:c++: Boost 1.48 type traits and Cocoa inclusion weirdness) Consequently I ended up including PCL headers as follows:

#define nil Boost_nil
#define Nil Boost_Nil
#ifdef check
#undef check
#endif

#include <pcl/pcl_base.h>
#include <pcl/point_types.h>
#include <pcl/filters/passthrough.h>

#undef Nil
#undef nil
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!