Re: Undefinded symbol

From: Matthias Teege <matthias(at)mteege.de>
Date: Thu, 11 Nov 1999 10:54:18 +0100

On Thu, Nov 11, 1999 at 09:02:18AM +0100, J Wunsch wrote:
> As Alexander Langer wrote:
>
> > 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?
>
> Die Libs müssen immer als letztes stehen.
>
> cc -o testpg -I... -L... testpq.c -lpq

vielen Dank für den Hinweis. Jetzt hat es auch wirklich geklappt.
Folgender Befehl ging durch:

 cc -o testpg -I /usr/local/pgsql/include -L /usr/local/pgsql/lib
 testpg.c -lpq

Das Programm konnte ich auch ausführen und es hat sogar das richtige
Ergebnis gebracht. Wow, mein erstes C Programm mit Datenbank Zugriff.
What a day.

> Normalerweise eher sogar getrennt:
>
> cc -I... -c testpq.c
> cc -o testpg -L... testpq.o -lpq
>
> Wobei mich natürlich die Beschwerde des `nm' schon stutzig macht...
> Matthias, Du bist Dir auch sicher, daß nicht nur die Lib da ist,
> sondern daß sie auch größer als 0 Byte lang ist? :-)

Das nm Problem hatte sich irgendwie noch aufgelöst. Vermutlich hatte
ich nur einen Tipp- oder Zugriffsfehler. Ich kannte das Programm ja noch
gar nicht habe aber durch die Verwendung noch einen Tippfehler in meinem
kleinen Programm gefunden. Manchmal ist ja ein "Undefined Symbol" auch
wirklich undefiniert.

Nochmal vielen Dank
Matthias

> --
> cheers, J"org
>
> joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
> Never trust an operating system you don't have sources for. ;-)
>
> To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
> with "unsubscribe de-bsd-questions" in the body of the message
>

-- 
Matthias Teege -- matthias@mteege.de -- http://emugs.de
make world not war
PGP-Key auf Anfrage
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:55:36 CET

search this site