probably an old question about overriding hardcoded library search paths
Jonathan Wakely
jwakely.gcc@gmail.com
Sun Nov 11 20:29:00 GMT 2012
On 11 November 2012 20:27, Charles Smith wrote:
> 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'
You need to list the library after the objects that depend on it.
The linker doesn't know it needs sqlite3_open_v2 until it sees a.o, by
which point it's already looked at libsqlite3.a and decided it doesn't
need any of its symbols.
More information about the Gcc-help
mailing list