1

I am currently working on a c++ project using xcode 8, and I keep getting this error:

Undefined symbols for architecture x86_64:
"liblas::Reader::Reader(std::__1::basic_istream<char, std::__1::char_traits<char> >&)", referenced from:
  _main in main.o
"liblas::Reader::~Reader()", referenced from:
  _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have compiled boost, liblas, etc. I have it included in my cmakelists.txt as well, and have the folder it is included in listed in 'Framework Search Paths' as well as 'Header Search Paths'. My compiler is the xcode 8 default of Apple LLVM 8.0. My deployment target is 10.11. The valid architectures are 'x86_64' and 'i386'.

Here is the code that attempts to use libLAS (file.las contains a hardcoded path to my las file). This code was pulled directly off the libLAS c++ tutorial here:

std::ifstream ifs;
ifs.open("file.las", std::ios::in | std::ios::binary);
liblas::ReaderFactory f;
liblas::Reader reader = f.CreateWithStream(ifs);

If I comment out the line liblas::Reader reader = f.CreateWithStream(ifs);, the code compiles fine, and produces a valid executable. With this line here, it throws the error. I need to be able to read LAS files with this project however, so I need to try to get the Reader to work.

So my questions are:

  1. Is there a better way to debug this?

  2. Is this an obvious error that I'm missing?

  3. Is this an issue with the library? (libLAS)

  4. What can I do to get this working?

Thanks to anyone in advance!

  • Make sure you have added all of your frameworks properly in project and target, and also imported them where needed. – AMAN77 Dec 20 '16 at 10:41

0 Answers0