Include MySQL
#1
Hello
I will include mysql in the mcserver code. All works but at the end it comes the error:
German:
Code:
/home/daniel/Schreibtisch/MCServer/lib/mysql/mysql_driver.h:89: Nicht definierter Verweis auf `sql::mysql::get_driver_instance()'
In english maybe:
Code:
/home/daniel/Schreibtisch/MCServer/lib/mysql/mysql_driver.h:89: Not defined reference on`sql::mysql::get_driver_instance()'

Code in Root.cpp:
Code:
void cRoot::LoadMySQL(void)
{
    try {
        sql::mysql::MySQL_Driver *driver;
        sql::Connection *con;

        /* Create a connection */
        driver = sql::mysql::get_mysql_driver_instance();
        con = driver->connect("ip:3306", "server", "1234");
        /* Connect to the MySQL test database */
        con->setSchema("permissions");

    } catch (sql::SQLException &e) {
        cout << "# ERR: SQLException in " << __FILE__;
        cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl;
        cout << "# ERR: " << e.what();
        cout << " (MySQL error code: " << e.getErrorCode();
        cout << ", SQLState: " << e.getSQLState() << " )" << endl;
    }

}
Includes:
Code:
#include <iostream>
#include "mysql/mysql_connection.h"
#include "mysql/mysql_driver.h"

#include "mysql/cppconn/exception.h"

using namespace std;

Code in Root.h:
Code:
///Load MySQL
    void LoadMySQL(void);

And i copy boost and mysql libs to the lib folder.
And i added in boost a CMakeList:
Code:
cmake_minimum_required (VERSION 2.6)
project (boost)

include_directories ("${PROJECT_SOURCE_DIR}/../../src/")

set(BOOST_ROOT "${PROJECT_SOURCE_DIR}")
I also had added to the root CMakeList:
Code:
add_subdirectory(lib/boost/)

I hope someone have an idea how can i fix this error.

Greetings, Daniel
Reply
Thanks given by:


Messages In This Thread
Include MySQL - by daniel0916 - 01-07-2014, 01:53 AM
RE: Include MySQL - by xoft - 01-07-2014, 02:27 AM
RE: Include MySQL - by daniel0916 - 01-07-2014, 02:48 AM
RE: Include MySQL - by bearbin - 01-07-2014, 02:37 AM
RE: Include MySQL - by xoft - 01-07-2014, 02:46 AM
RE: Include MySQL - by FakeTruth - 01-07-2014, 02:47 AM
RE: Include MySQL - by xoft - 01-07-2014, 02:49 AM
RE: Include MySQL - by daniel0916 - 01-07-2014, 03:31 AM
RE: Include MySQL - by xoft - 01-07-2014, 04:22 AM
RE: Include MySQL - by daniel0916 - 01-07-2014, 04:32 AM
RE: Include MySQL - by xoft - 01-07-2014, 05:12 AM
RE: Include MySQL - by daniel0916 - 01-07-2014, 05:48 AM
RE: Include MySQL - by NiLSPACE - 01-07-2014, 04:34 AM
RE: Include MySQL - by xoft - 01-07-2014, 06:25 AM
RE: Include MySQL - by daniel0916 - 01-08-2014, 02:25 AM
RE: Include MySQL - by xoft - 01-08-2014, 02:52 AM
RE: Include MySQL - by daniel0916 - 01-08-2014, 04:20 AM
RE: Include MySQL - by daniel0916 - 01-09-2014, 02:50 AM
RE: Include MySQL - by xoft - 01-09-2014, 05:31 AM
RE: Include MySQL - by daniel0916 - 01-09-2014, 05:39 AM
RE: Include MySQL - by xoft - 01-09-2014, 05:46 AM
RE: Include MySQL - by daniel0916 - 01-09-2014, 05:49 AM
RE: Include MySQL - by xoft - 01-09-2014, 04:51 PM
RE: Include MySQL - by daniel0916 - 01-10-2014, 03:07 AM
RE: Include MySQL - by xoft - 01-10-2014, 06:59 AM
RE: Include MySQL - by daniel0916 - 01-12-2014, 01:49 AM
RE: Include MySQL - by xoft - 01-12-2014, 02:33 AM
RE: Include MySQL - by daniel0916 - 01-12-2014, 05:40 AM
RE: Include MySQL - by xoft - 01-12-2014, 06:01 AM



Users browsing this thread: 4 Guest(s)