Postgres kein zugriff



  • Hallo, ich habe ein Problem beim zugriff auf meine Datenbank. ich bekomm bei meiner libpqxx Datei immer wieder Fehlermeldungen.
    Die Dateien werden gefunden, aber in diesen gibt es angeblich Fehler.
    Ich nutzte kubuntu.

    danke für eure Hilfe 🙂

    #ifdef HAVE_CONFIG_H
    #include <config.h>
    #endif

    #include <iostream>
    #include <cstdlib>
    #include <pqxx/pqxx>

    using namespace std;
    using namespace pqxx;

    int main(int argc, char *argv[])
    {

    connection conn("do something");

    return EXIT_SUCCESS;
    }

    weitere angabe Bibliotheken:

    -L/usr/lib/pgsql
    -I/usr/include/pgsql

    postgres.o: In function connect_direct': /usr/include/pqxx/connection.hxx:84: undefined reference topqxx::connectionpolicy::connectionpolicy(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    /usr/include/pqxx/connection.hxx:84: undefined reference to vtable for pqxx::connect_direct' postgres.o: In function~connect_direct':
    /usr/include/pqxx/connection.hxx:82: undefined reference to vtable for pqxx::connect_direct' /usr/include/pqxx/connection.hxx:82: undefined reference topqxx::connectionpolicy::~connectionpolicy()'
    postgres.o: In function basic_connection': /usr/include/pqxx/basic\_connection.hxx:61: undefined reference topqxx::connection_base::connection_base(pqxx::connectionpolicy&)'
    /usr/include/pqxx/basic_connection.hxx:62: undefined reference to pqxx::connection\_base::init()' postgres.o: In function~basic_connection':
    /usr/include/pqxx/basic_connection.hxx:70: undefined reference to `pqxx::connection_base::close()'
    collect2: ld returned 1 exit status
    gmake[2]: *** [postgres] Fehler 1
    gmake[2]: Das Target »all« wurde wegen Fehlern nicht aktualisiert.
    gmake[1]: *** [all-recursive] Fehler 1
    gmake: *** [all] Fehler 2
    *** Exited with status: 2 ***



  • -L/usr/lib -lpqxx

    das war mein Fehler



  • Du mußt noch mittels "-l..." (kleines L) den Namen der Postgres-Library angeben. Ich glaube einfach "-lpqxx".

    Das sind übrigens Linker-Fehler, d.h. deine C++ Dateien sind generell in Ordnung.


Anmelden zum Antworten