Building a dynamic library using Xcode
Building a dynamic library using Xcode
- Subject: Building a dynamic library using Xcode
- From: Chris in Public <email@hidden>
- Date: Mon, 01 Oct 2012 08:34:18 +0800
Hi,
I'm using "C/C++ Library" project template in Xcode 4.5 (build 4G182) to learn how to build a dynamic library in C using Xcode.
In the dylib project, - C source files and their corresponding headers compiled without error. There are three .c file, each with 1 function definition. Each .c file does #include its corresponding header file which contains the corresponding function declaration.
- within each .c file, set the visibility using #define EXPORT __attribute__((visibility("default"))) followed by prefixing the function definition for e.g. EXPORT foo(void).
- within each .c file there is only local variable within the scope of the function; there is no global variable used so there was no static declaration of variables.
- I created an export list using Exports File template and added all functions, one function per line, which is saved within the dylib project.
- Archived the project and (sudo) copied the dylib to /usr/local/lib.
In the client project created using the Command Line Tool project template, I added the dylib to the target's Link Binaries with Libraries.
When I build and run the client project, Xcode reports no warnings and one error with the following message ld: library not found for -lfooDylib clang: error: linker command failed with exit code 1 (use -v to see invocation) Library not found for -lfooDylib
Why does Xcode emits this error since the dylib exists in /usr/local/lib and the dylib has been added to the target's Link Binaries with Libraries?
Thanks, Chris
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden