Problema al conectar con C++
Estimados:
Tengo el siguiente inconveniente, utilizo QT Creator y estoy probando hacer una conexión simple de C++ y MySQL. Este es el codigo principal:
#include "mainwindow.h"
#include "ui_mainwindow.h"
// Debemos incluir las siguientes cabeceras
#include <mysql_connection.h>
#include <cppconn/driver.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <cppconn/exception.h>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
sql::Driver *driver;
sql::Connection *connection;
sql::Statement *statement;
sql::ResultSet *resultset;
// Nos conectamos a nuestro servidor MySQL
driver = get_driver_instance();
connection = driver->connect("tcp://127.0.0.1:331", "root", "");
// Elegimos una base datos que ya tengamos creada
connection->setSchema("remiseria");
// Hacemos nuestra primera consulta
statement = connection->createStatement();
resultset = statement->executeQuery("INSERT INTO localidad(nombre) VALUES ('villaguay') ");
// Eliminamos los objetos
delete resultset;
delete statement;
delete connection;
}
El problema es que al compilar me salen los siguientes errores:
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
Alguien me puede dar una mano de donde está el problema porque no me deja ni arrancar a trabajar.
Gracias por su ayuda, saludos.
Subject
Views
Written By
Posted
Problema al conectar con C++
2701
August 08, 2014 11:47AM
915
August 08, 2014 12:44PM
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.