MySQL Forums
Forum List  »  Connector/C++

Problem with C++ Connector
Posted by: yo argentino
Date: August 08, 2014 01:08PM

Sorry, mi english is not very good, i've got this problem:
I'm using QT Creator and I am trying to make a conection between C++ and MySQL.

My code:

#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <mysql_connection.h>
#include <cppconn/driver.h>
#include <cppconn/resultset.h>

#include <cppconn/statement.h>
#include <cppconn/exception.h>

MainWindow::MainWindow(QWidget *parent) :
ui(new Ui::MainWindow)

delete ui;

void MainWindow::on_pushButton_clicked()
sql::Driver *driver;
sql::Connection *connection;
sql::Statement *statement;
sql::ResultSet *resultset;

driver = get_driver_instance();
connection = driver->connect("tcp://", "root", "");


statement = connection->createStatement();
resultset = statement->executeQuery("INSERT INTO city(name) VALUES ('villaguay') ");

delete resultset;
delete statement;
delete connection;


When I Run and Compile:

C:\Users\Pablo\Desktop\Remises\build-untitled-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\mainwindow.o:-1: In function `ZN10MainWindow21on_pushButton_clickedEv':

C:\Users\Pablo\Desktop\Remises\untitled\mainwindow.cpp:32: error: undefined reference to `_imp__get_driver_instance'

collect2.exe:-1: error: error: ld returned 1 exit status

Thanks for your helps.

Options: ReplyQuote

Written By
Problem with C++ Connector
August 08, 2014 01:08PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.