Linker error when linking external library (OSX)

Hello,

I am trying to use an imported library in a console project for OSX 10.9. I am using the latest official release of Elements / Oxygene (v7.1.75.1541). The library is “Chilkat Zip Objective-C Library for MAC OS X” (http://www.chilkatsoft.com/zip-objc.asp). I have been able to successfully create the FX file using FxGen and am able to create an instance of the library in my program. But when I try to build it, the linker displays the following message:

Error    2    (Link) Undefined symbols for architecture x86_64:
  “OBJC_CLASS$_CkoZip”, referenced from:
      objc-class-ref in Chilkat_Zip_Test.o
ld: symbol(s) not found for architecture x86_64
    C:\Program Files\MSBuild\RemObjects Software\Oxygene\RemObjects.Oxygene.Nougat.targets    329    5    Chilkat_Zip_Test

I would appreciate any help in how to fix this. I have referenced the FX file in the project and also placed the library file (libchilkatCocoa.a) in the same directory as the FX file.

Thanks and regards,
Olaf

When linking to this from the ide. Do you have a libchilkatCocoa.a and libchilkatCocoa.fx (same name) next to eachother when referencing it from the IDE?

Also, are you sure the library actually is x64? Selecting x64 in FXGen just affects how we process the headers, we do not check if the actual .a file contains a x64 binary…

Thanks for your suggestions. Unfortunately, they did not make a difference.

To remove complexity from the problem I followed the instructions to Create C Program with Static Library using Xcode in Mac OS X which allowed me to create and test a very simple library. Everything worked fine on the C side of things in Xcode, but again, when I created the FX file and added the library to an Oxygene project, the project compiled but the linker complained as before:

Error 2 (Link) Undefined symbols for architecture x86_64: “_PowerOf2”, referenced from: +[Program Main:] in MyMathTest.o ld: symbol(s) not found for architecture x86_64 C:\Program Files\MSBuild\RemObjects Software\Oxygene\RemObjects.Oxygene.Nougat.targets 329 5 MyMathTest

I have uploaded all files to DropBox in case you’re interested in the code:
https://dl.dropboxusercontent.com/u/7196033/mymath.zip

Regards, Olaf

Got it. your library never gets linked, because you didn’t fill the “Libraries to Link” field. if you add “mymath” there, all should be fine.

1 Like

Sorry for the late reply and thanks for your support.
You are right: specifying the library in the “Libraries to Link” field did the trick.

Regards, Olaf

1 Like