• 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
Re: C++ Static library fails to link for some code, relocatable object works fine
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ Static library fails to link for some code, relocatable object works fine


  • Subject: Re: C++ Static library fails to link for some code, relocatable object works fine
  • From: Peter O'Gorman <email@hidden>
  • Date: Mon, 14 Jul 2008 15:23:15 -0500

Adam Zegelin wrote:
> Hi,
>
>     I'm trying to build a project that uses sqlite3x, a C++ wrapper for
> SQLite3. I've created a new "sqlite3" static library target which
> includes all the sqlite3 and sqlite3x source files. This target is then
> added as a dependency of the main application (Cocoa) target, and the
> static lib product is added to the "Linked Libraries" list in the target
> settings of the main target.
>
>     The project fails to link. I've been working on this for hours, and
> gave up, eventually stripping my main.mm file down to
>
> #include "../sqlite3x/sqlite3x.hpp"
>
> int main(int argc, char *argv[])
> {
>     sqlite3x::sqlite3_connection    c;
> }
>
>     That shows the problem perfectly. ld spits out:
>
> Undefined symbols:
>   "__ZN8sqlite3x18sqlite3_connectionC1Ev", referenced from:
>       _main in main.o
>   "__ZN8sqlite3x18sqlite3_connectionD1Ev", referenced from:
>       _main in main.o
>       _main in main.o
> ld: symbol(s) not found
>
>     Yet the output of `nm libsqlite3.a` shows the symbols defined:

The linker is likely picking /usr/lib/libsqlite3.dylib in preference to
your libsqlite3.a. See the "static to override dylib" thread.

Peter
--
Peter O'Gorman
http://pogma.com
 _______________________________________________
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: C++ Static library fails to link for some code, relocatable object works fine
      • From: Adam Zegelin <email@hidden>
References: 
 >C++ Static library fails to link for some code, relocatable object works fine (From: Adam Zegelin <email@hidden>)

  • Prev by Date: Re: Non human friendly error message from compiler with exceptions
  • Next by Date: Re: C++ Static library fails to link for some code, relocatable object works fine
  • Previous by thread: C++ Static library fails to link for some code, relocatable object works fine
  • Next by thread: Re: C++ Static library fails to link for some code, relocatable object works fine
  • Index(es):
    • Date
    • Thread