Undefined reference to mysql while using cross-compiler

Sysprogs forums Forums VisualGDB Undefined reference to mysql while using cross-compiler

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7687
    hindus
    Participant

    Hi, I’m trying to compile simple C++ program for Raspberry PI using cross-compiler method. I’ve done everything in the tutorial http://visualgdb.com/tutorials/raspberry/wiringPi/ and managed to run sample blinking led application, so everything seems to be configured ok.

    Now I want to add some mysql support to log changes and read some config info.

    #include 
    #include <mysql/mysql.h>
    
    int main(int argc, char *argv[])
    {
        wiringPiSetup();
    
        MYSQL *mysql1 = mysql_init(NULL);
    
    
    }

    Unfortunatelly, I get en error:

    ‘NULL’ was not declared in this scope

    I tried to include

    #include <mysql/my_global.h>

    so NULL was no longer undeclared, but another error showed:

    error VGDB1000: undefined reference to `mysql_init’

    What did I do wrong? Thanks!

    #7688
    hindus
    Participant

    Okay, I’ve found the solution. I was adding ‘mysql’ to ‘Library names’, but the correct name for mysql was ‘mysqlclient’. Everything works like a charm now 🙂

    #7693
    support
    Keymaster

    Good to know it works. If you encounter further problems, let us know.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.