Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Linux [MAKE]-Problem mit Postgresql Datenbankzugriff über C++

Empfohlene Antworten

Veröffentlicht

Hi,

folgendes Problem. Ich möchte über C++ auf eine Postgresql-Datenbank zugreifen. Der Compiler bringt keine Fehler. Die Fehlermeldung deutet auf einen Linkerfehler hin, aber ich kann nicht sagen, aus welcher (Quellcode)Datei der Fehler gemeldet wird. Was mir aufgefallen ist: Die Pfade für Postgresql-Systemdateien sind im Buch anders als in der Suse 8.0 RPM-Installation auf meinem Rechner. Kann mir jemand einen Tipp zur Fehlersuche geben?

***********@linux:~> make

gcc -lpq -I/usr/local/********/include main.cpp -o prog

/tmp/cc7Ln33o.o: In function `__malloc_alloc_template<0>::_S_oom_malloc(unsigned int)':

/tmp/cc7Ln33o.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x1a): undefined reference to `endl(ostream &)'

/tmp/cc7Ln33o.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x27): undefined reference to `cerr'

/tmp/cc7Ln33o.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x2c): undefined reference to `ostream::operator<<(char const *)'

/tmp/cc7Ln33o.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x37): undefined reference to `ostream::operator<<(ostream &(*)(ostream &))'

/tmp/cc7Ln33o.o: In function `basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::Rep::copy(unsigned int, char const *, unsigned int)':

/tmp/cc7Ln33o.o(.basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::Rep::gnu.linkonce.t.copy(unsigned int, char const *, unsigned int)+0x33): undefined reference to `string_char_traits<char>::copy(char *, char const *, unsigned int)'

collect2: ld returned 1 exit status

make: *** [prog] Fehler 1

-----

Suse Linux 8.0

(PostgreSQL) 7.2

GNU Make version 3.79.1

-----

@mod: Ich bin mir nicht sicher, ob das jetzt eher als Compilerproblem oder doch ein Linux oder Datenbankproblem zu betrachten ist. Bitte ggf. verschieben. Danke.

[meine Fehlermeldung gelöscht - weil nicht mehr benötigt]

gcc -lpq -stdc++ -I/usr/local/postgresql/include main.cpp -o prog

--> wer lesen kann ist klar im Vorteil :D

ich hab das "l" übersehen. ;)

gcc -lpq -lstdc++ -I/usr/local/postgresql/include main.cpp -o prog

--> so funktionierts.

Kaum macht mans richtig funktionierts. Anscheinend ein Druckfehler in meinem Buch.

(ich werd dem Verlag gleich mal eine eMail schicken).

DANKE für deinen Hinweis - ich bin fast verzweifelt...

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.