• 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
libraries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libraries


  • Subject: libraries
  • From: Philip George <email@hidden>
  • Date: Sun, 20 Jul 2003 17:42:09 -0500

Ok, I've just wrecked my eyes and brain reading through the man pages for
both gcc and ld, and I still can't quite get my head around how to do
something that i KNOW has got to be really simple.

All I want to do is build a library (in standard C) with a couple of
functions in it, then include it in my project, and use it.

For testing, I've been just using one dummy function:

int adder(int a, int b) {
return (a+b);
}

I compiled like this first:

gcc adder.c -object

which wouldn't work, because gcc wanted me to use the "-static" flag. So
then I tried:

gcc adder.c -static -object

which couldn't find some symbol(s), so I did:

gcc adder.c -nostdlib -static -object

which compiled without warnings or errors.

I renamed "a.out" to "adderlib" and added it to my little test cocoa obj-c
project and tried to compile. I got:

Undefined symbols: _adder

So then I opened the project target and dropped the adderlib file from the
file list into the "Frameworks and Libraries" list.

Same result. Couldn't find the symbol "_adder" (my function name).

What am I doing wrong here?

Keep in mind I want this to be a static library that gets completely
embedded into the final cocoa app. I don't want it to have to link it in
dynamically on every launch.

Thanks.

- Philip
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: libraries
      • From: Tomas Zahradnicky <email@hidden>
  • Prev by Date: Re: Forum for advanced Cocoa questions
  • Next by Date: Re: Forum for advanced Cocoa questions
  • Previous by thread: Re: #import problem
  • Next by thread: Re: libraries
  • Index(es):
    • Date
    • Thread