views:

370

answers:

1
+1  Q: 

xcode linker error

I'm trying to compile a bundle that uses a third party library. I've had this working a while ago, but now it just refuses to link. Here's a sample of the errors:

  "lwpp::GlobalBase<char const* ()(char const*)>::globPtr", referenced from:
  __ZN4lwpp10GlobalBaseIFPKcS2_EE7globPtrE$non_lazy_ptr in main.o
  __ZN4lwpp10GlobalBaseIFPKcS2_EE7globPtrE$non_lazy_ptr in license-2998A499.o 
  ...
ld: symbol(s) not found 
collect2: ld returned 1 exit status

The third party project (lwpp) is included as a sub-project. I've clicked and dragged it's build products into the Targets > plugin_name > Link Binary With Libraries, but it still does not work. If I import the source files for the lwpp, then these link errors all go away. I'm at a complete loss.

+1  A: 

Apparently lwpp::GlobalBase< char const* ()(char const*) > ::globPtr must be defined somewhere. Either you have to define it yourself in a source file, or if it is already defined in the library, you may need to declare it as extern in main.cpp .

Dima
It's defined in the library. As I said I've had it working before, but now xcode / gcc has decided that it wont link. I've had a friend try it and for him it links and compiles ok on his machine. I try and use the same project file on my machine and I get linker errors. It makes no sense.
Anti-Distinctlyminty
I am just guessing here, but the problem may be template instantiation... Try explicitly instantiating GlobalBase<char const * () (char const*)>
Dima