01-07-2014, 01:53 AM
(This post was last modified: 01-07-2014, 01:55 AM by daniel0916.)
Hello
I will include mysql in the mcserver code. All works but at the end it comes the error:
German:In english maybe:
Code in Root.cpp:
Includes:
Code in Root.h:
And i copy boost and mysql libs to the lib folder.
And i added in boost a CMakeList:
I also had added to the root CMakeList:
I hope someone have an idea how can i fix this error.
Greetings, Daniel
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()'
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;
}
}
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}")
Code:
add_subdirectory(lib/boost/)
I hope someone have an idea how can i fix this error.
Greetings, Daniel