I confess I'm confused. I thought that it worked, but now it's not working any more: g++ \ -L"/home/me/dir1" \ -L"/home/me/dir2" \ -L"/home/me/dirn" \ /home/me/opt/lib/libsqlite3.a \ -o "FLAT" ./a.o ./b.o -llib1 -llib2 -llibn /home/me/dir2/liblib2.a(layer.o): In function `Entity::get_ip_config(char*)': /home/me/a.cc:86: undefined reference to `sqlite3_open_v2' --- On Sun, 11/11/12, Marc Glisse <marc.glisse@xxxxxxxx> wrote: > From: Marc Glisse <marc.glisse@xxxxxxxx> > Subject: Re: probably an old question about overriding hardcoded library search paths > To: "Charles Smith" <cts.private@xxxxxxxxx> > Cc: gcc-help@xxxxxxxxxxx > Date: Sunday, November 11, 2012, 6:52 AM > On Sun, 11 Nov 2012, Charles Smith > wrote: > > > How can I force a private copy of sqlite3 to be linked > to my > > application? > > You can always pass /path/to/libA.a instead of -L/path/to > -lA. > > > My ubuntu 10.04 system has sqlite3 in /usr/local/lib > and /usr/lib. > > I want to link my application with a private version of > sqlite3. > > Using -L and -l doesn't work because the additional > directory is > > "appended" to the search path. > > No. It might give priority to dynamic libraries over static > ones though. > See -Bstatic in the documentation of the linker. > > -- Marc Glisse >