Free Ground Shipping on all orders over $100 (US Only)
login   |   Register

Welcome Forums Tarts for Raspberry Pi Adding MySQL support

Tagged: 

This topic contains 3 replies, has 4 voices, and was last updated by Glenn Seaton wgseaton 2 years, 6 months ago.

  • Author
    Posts
  • #3550
    scott
    scott
    Participant

    I have tried including the mysql.h to my project but cannot get the TartsBasic to compile.

    The following error is presented when trying to compile:

    TartsBasic.o: In function `mysql_connect()’:
    TartsBasic.cpp:(.text+0x598): undefined reference to `mysql_init’
    TartsBasic.cpp:(.text+0x5d0): undefined reference to `mysql_real_connect’
    TartsBasic.cpp:(.text+0x5f8): undefined reference to `mysql_error’
    TartsBasic.o: In function `mysql_disconnect()’:
    TartsBasic.cpp:(.text+0x638): undefined reference to `mysql_close’

    I am trying to add mysql_config --cflags mysql_config --libs and simply compiling the TartsBasic.cpp but cannot get any success.

    Once I can get it to simply compile I will add more functions to store my data.

    Can someone point me in the right direction?

    Thanks,

    Scott

  • #3551
    Kelly Lewis
    kellyl
    Participant

    Hello Scott,

    I talked to the engineers here and none have SQL experience in C. Sorry I cannot be of more help 🙁

    Kelly

  • #3568
    Mike
    Mike
    Participant

    Hi Scott,

    Did you add back-ticks around the mysql_config –cflags –libs? It should look like mysql_config --cflags --libs in your makefile.

    Mike

  • #3888
    Glenn Seaton
    wgseaton
    Participant

    Hi Scott,
    I am not sure what I did different but i have MySQL working on my PI 3 and write the sensor data to a sql log table with no problems.
    My includes are
    #include <Tarts.h>
    #include <TartsStrings.h>
    #include <iostream>
    #include <sstream>
    #include <ctime>
    #include <cstring>

    #include <mysql/mysql.h>
    #include <string>
    #include <typeinfo>:

    If that helps any.

You must be logged in to reply to this topic.

Support
Contact Us!

Your Name (required)

Your Email (required)

Subject

Your Message

Enter this code below: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed.