• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Building a dynamic library using Xcode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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, 
  1. 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.
  2. 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).
  3. 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.
  4. I created an export list using Exports File template and added all functions, one function per line, which is saved within the dylib project.
  5. 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

  • Follow-Ups:
    • Re: Building a dynamic library using Xcode
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Any way to "flatten" a resource file target on output?
  • Next by Date: Re: Any way to "flatten" a resource file target on output?
  • Previous by thread: Re: Any way to "flatten" a resource file target on output?
  • Next by thread: Re: Building a dynamic library using Xcode
  • Index(es):
    • Date
    • Thread