Re: Undefinded symbol

From: Alexander Langer <alex(at)cichlids.com>
Date: Thu, 11 Nov 1999 11:16:39 +0100

Thus spake J Wunsch (j(at)uriah.heep.sax.de):

> > Versuch mal folgendes :)
> > cc -o testpg -I ... /usr/local/pgsql/lib/libpq.a testpq.c
> Ist aber auch falsch. Das konnte alles nicht funktionieren bisher,
> dieweil das C-File ja immer als letztes angegeben worden ist. Woher
> soll der Linker dann wissen, was genau aus der Bibliothek alles mit
> reinsoll?

HU?
Das war bei mir bis jetzt immer voellig egal:

alex:~ $ cat testlib.c
#include <stdio.h>

void bla()
{
        printf("Hallo\n");
}
alex:~ $ cat testlibuse.c
void bla();

main() {
            bla();
            return 0;
}
alex:~ $ cc --shared -o libtestlib.a testlib.c
alex:~ $ cc -o testlibuse libtestlib.a testlibuse.c
alex:~ $ ./testlibuse
Hallo
alex:~ $

Oder auch

alex:~ $ cc -o libtestlib.a --shared testlib.c
alex:~ $ cc -o testlibuse -L. -ltestlib testlibuse.c
alex:~ $ ./testlibuse
Hallo
alex:~ $

> Die Libs müssen immer als letztes stehen.
> cc -o testpg -I... -L... testpq.c -lpq

Wo steht das?
SYNOPSIS
       gcc [ option | filename ]...

dann wäre eine testlib.c ja eine option, oder die lib ein filename.
Oder die -l waere keine option.

> Normalerweise eher sogar getrennt:
> cc -I... -c testpq.c
> cc -o testpg -L... testpq.o -lpq

Ja. Das auch. Allerdings sehe ich nicht den Nutzen von Lib hinter
Datei.

Alex

-- 
I doubt, therefore I might be. 

To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Thu 11 Nov 1999 - 11:16:26 CET

search this site