objective-cgnu-makegnustep

undefined reference to '__objc_class_name_...'


I am building an executable (GNUstep).

It depends on a libLibname.a static lib.

In the GNUmakefile of the executable I am linking libLibname.a like this:

executableToolName_LDFLAGS = /usr/GNUstep/Local/Library/Libraries/libLibname.a

It claims to link without errors:

Linking tool executableToolName ...

Problem: It seems to not find the symbols:

main.m:29: error: undefined reference to '._OBJC_REF_CLASS_SomeClassNameOfLibLibname'

Solution

  • ..._LDFLAGSis only for libray targets.

    For tool targets, linked libs must be listed in ADDITIONAL_OBJC_LIBS, prefixed with -l