Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-450

undefined reference to `mysql_init'

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • None
    • N/A
    • None
    • None
    • Ubuntu 18.04

    Description

      I have the most recent package:
      sudo apt install mariadb-server
      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      mariadb-server is already the newest version (1:10.1.43-0ubuntu0.18.04.1).
      0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

      The following program:

      #include <iostream>
      #include <mysql.h>
      int main(int argc, char *argv[])

      { MYSQL *conn; conn=mysql_init(NULL); mysql_close(conn); return 0; }

      when compiled with

      g++ -I/usr/include/mariadb -I/usr/include/mariadb/mysql -L/usr/lib/x86_64-linux-gnu/ -lmariadb -lz -ldl -lm -lpthread my.cpp

      gives the error:

      /tmp/cchC9TlH.o: In function `main':
      my.cpp.text+0x15): undefined reference to `mysql_init'
      my.cpp.text+0x25): undefined reference to `mysql_close'
      collect2: error: ld returned 1 exit status

      Attachments

        Activity

          People

            georg Georg Richter
            perrywinkel Perry Winkel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.