I am using Windows 7 x64 with Code::Blocks and GCC compiler vesion 4.4.1 and I am getting undefined reference to `_imp__get_driver_instance' error when I attempt to compile, I know its a linker error but I thought I had linked everything correctly.
Here is my configuration in cod::blocks, I hope you don't mind I uploaded screen shots to imageshack to make it easier to show.
Search Compiler settings
http://img684.imageshack.us/img684/903/cbcompiler.jpg
Search Linker settings
http://img214.imageshack.us/img214/8514/cbsearchlinker.jpg
Linker attempt 1
http://img641.imageshack.us/img641/9908/cblinker.jpg
Linker attempt 2
http://img522.imageshack.us/img522/4165/cblinker2.jpg
Someone please help I have been googling this for hours and I just want it to work already =(
Here is my configuration in cod::blocks, I hope you don't mind I uploaded screen shots to imageshack to make it easier to show.
Search Compiler settings
http://img684.imageshack.us/img684/903/cbcompiler.jpg
Search Linker settings
http://img214.imageshack.us/img214/8514/cbsearchlinker.jpg
Linker attempt 1
http://img641.imageshack.us/img641/9908/cblinker.jpg
Linker attempt 2
http://img522.imageshack.us/img522/4165/cblinker2.jpg
Someone please help I have been googling this for hours and I just want it to work already =(
/* Standard C++ includes */ #include <stdlib.h> #include <iostream> /* Include directly the different headers from cppconn/ and mysql_driver.h + mysql_util.h (and mysql_connection.h). This will reduce your build time! */ #include "mysql_connection.h" #include <cppconn/driver.h> #include <cppconn/exception.h> #include <cppconn/resultset.h> #include <cppconn/statement.h> using namespace std; int main(void) { cout << endl; cout << "Running 'SELECT 'Hello World!'AS _message'..." << endl; try { sql::Driver *driver; sql::Connection *con; sql::Statement *stmt; sql::ResultSet *res; /* Create a connection */ driver = get_driver_instance(); con = driver->connect("tcp://127.0.0.1:3306", "root", "root"); /* Connect to the MySQL test database */ con->setSchema("test"); stmt = con->createStatement(); res = stmt->executeQuery("SELECT 'Hello World!' AS _message"); while (res->next()) { cout << "\t... MySQL replies: "; /* Access column data by alias or column name */ cout << res->getString("_message") << endl; cout << "\t... MySQL says it again: "; /* Access column fata by numeric offset, 1 is the first column */ cout << res->getString(1) << endl; } delete res; delete stmt; delete con; } 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; } cout << endl; return EXIT_SUCCESS; }