Newbie-Problem:
I have a small test-class (TestLibMain.cpp) in c++ an compiled it to a “libTestLib.dylib” which is located in a subdirectory “debug” of the directory containing the TestLibMain.h-file.
How can I use the dylib from my Xcode-project? I imported the TestLibMain.h in my code and set the Header-search path in build settings. This works fine. But now the linker tells me that he can’t find the dylib (nor the “TestLibMain.cpp” file which he could compile himself…). The dylib was created in Ecplise/CDT has a different name: “libTestLib.dylib”. Setting the “Library search paths” in Xcode doesn’t help….
This my error message:
Undefined symbols for architecture i386:
"TestLibMain::TestLibMain()", referenced from:
-[tbViewController viewWillAppear:] in tbViewController.o
"TestLibMain::getNumber()", referenced from:
-[tbViewController viewWillAppear:] in tbViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Questions:
- Is it possible to link a dylib-file created for i386 in Xcode? I want to use in a Xcode- project compiled libs from a project in Eclipse (which I want to reuse in Android NDK…)
- How can I make Xcode find the dylib-file?
- Is actually the dylib file the right file to link? There has no .a file created by eclipse, but a .d and a .o file?
1.If you are using the dylib for the iOS project – it is not possible, cause it is not permitted by Apple to use custom dynamic libraries. You also can’t use libraries built using NDK even if they are for the same architecture, cause they have different binary format (Mac OS and iOS use Mach-O and Android uses ELF).
2.Go to your target preferences->Build phases->press ‘+’->Add other
3.dylib is the right file unless it is not an iOS project.