Question: How to use PCL in the context of Cocoa's Objective-C application (OSX, not iOS)?
Tearing my hair off of it. I cannot get libpcl to correctly reference my Objective-C project in Xcode. I checked and double-checked everything that I can think of. Iβm probably doing something dumb, but I'm at a dead end.
The actual error is the linker:
Undefined symbols for architecture x86_64: "pcl::PassThrough<pcl::PointXYZ>::applyFilterIndices(std::__1::vector<int, std::__1::allocator<int> >&)", referenced from: pcl::PassThrough<pcl::PointXYZ>::applyFilter(std::__1::vector<int, std::__1::allocator<int> >&) in PCLProcess.o ld: symbol(s) not found for architecture x86_64
The code I'm trying to compile is the standard tutorial code available here: http://pointclouds.org/documentation/tutorials/passthrough.php#passthrough
I can make it work without Xcode (using Cmake and compiling the command line just like in the tutorial)
I can create a command line project and compile and link a one-time CPP file using Xcode
The problem is the same no matter which version of PCL I tried. Macports, a binary distribution, self-compiled 1.6 and trunk. All the same, the result.
I tried several different machines, OSX 10.7 and 10.8, the same thing on both.
I even run nm against dylib to verify that the missing characters are in the library that I am linking (in this case, filters)
Any thoughts that were highly appreciated, I lost this week for six months.
For a detailed error message, see this screenshot .
Here is the code in question:
//PCLProcess.h #import <Foundation/Foundation.h> @interface PCLProcess : NSObject @end //PCLProcess.mm #import "PCLProcess.h" #include <pcl/point_types.h>
Update
Here is another key. I am above my head regarding compilers / linkers and how they work, but now I think I know what is happening, but not why (or how to fix it).
I ran the linker tool manually, and out of desperation, I started connecting obsolete checkboxes to see what the results were. The previous error (above) identifies the missing characters as "pcl :: PassThrough :: applyFilterIndices (std :: __ 1 :: vector> &)", but ld -y gave me this:
ld: warning: -y option is obsolete and is ignored Undefined for architecture x86_64: "__ ZN3pcl11PassThroughINS_8PointXYZEE18applyFilterIndicesERNSt3__16vectorIiNS3_9allocatorIiEEEE", which is referred to: __ ZN3pcl11PassThroughINS_8PointXYZEE11applyFilterERNSt3__16vectorIiNS3_9allocatorIiEEEE in PCLProcess.o ld: symbol (s) could not be found for the x86_64 architecture
So, I went looking for this symbol and, of course, it is missing (or another):
nm /opt/local/lib/libpcl_filters.dylib | grep __ZN3pcl11PassThroughINS_8PointXYZEE18applyFilterIndices 00000000000a0fa0 T __ZN3pcl11PassThroughINS_8PointXYZEE18applyFilterIndicesERSt6vectorIiSaIiEE
I suspect the name is changed? But then again, I'm not quite sure what I'm talking about now or (more importantly) how to fix it.