mysql.h



  • nach g++ -o mysql mysql.cc kommt folgende ausgabe:

    /tmp/cchpRG89.o: In function main': /tmp/cchpRG89.o(.text+0x1d): undefined reference tomysql_init'
    /tmp/cchpRG89.o(.text+0x44): undefined reference to mysql\_real\_connect' /tmp/cchpRG89.o(.text+0x73): undefined reference tomysql_query'
    /tmp/cchpRG89.o(.text+0x91): undefined reference to mysql_error' /tmp/cchpRG89.o(.text+0xb9): undefined reference tomysql_store_result'
    /tmp/cchpRG89.o(.text+0xde): undefined reference to mysql\_fetch\_row' /tmp/cchpRG89.o(.text+0x10a): undefined reference tomysql_num_fields'
    /tmp/cchpRG89.o(.text+0x169): undefined reference to mysql_errno' /tmp/cchpRG89.o(.text+0x182): undefined reference tomysql_error'
    /tmp/cchpRG89.o(.text+0x1a9): undefined reference to mysql\_free\_result' /tmp/cchpRG89.o(.text+0x1b9): undefined reference tomysql_close'
    /tmp/cchpRG89.o(.text+0x1e1): undefined reference to mysql_errno' /tmp/cchpRG89.o(.text+0x1f7): undefined reference tomysql_error'
    /tmp/cchpRG89.o(.text+0x20a): undefined reference to `mysql_errno'
    collect2: ld returned 1 exit status

    die selbe liste kommt bei verschiedenen codebeispielen also vermute ich das ich die mysql.h noch irgendwie beim compilieren einbauen muss oder so

    bin relativ neu in sachen linux & c++ also nicht wundern 😉
    danke



  • Hallo,

    probiers mal so:

    g++ -o mysql mysql.cc -lmysql
    


  • CarstenJ schrieb:

    Hallo,

    probiers mal so:

    g++ -o mysql mysql.cc -lmysql
    

    danke mit -lmysqlclient funktioniert es


Anmelden zum Antworten