Error connecting Mysql to Vscode with c++

Asked

Viewed 270 times

0

I’m trying to connect the Mysql for some time in the Vscode with the linux OS Mint +19, and I’m not making it after taking the following steps:

I downloaded Connector on the Mysql website: https://dev.mysql.com/downloads/connector/cpp/

with the following files:

inserir a descrição da imagem aqui

Within the include folder has the files:

inserir a descrição da imagem aqui

Within the folder lib64 has the files:

inserir a descrição da imagem aqui

and put the files of include folder in -> /usr/include/ and the archives of folder lib64 put in -> /usr/lib/

The code I made in Vscode was very simple:

#include <stdlib.h>
#include <iostream>

#include <jdbc/mysql_connection.h>
#include <jdbc/mysql_driver.h>
#include <jdbc/cppconn/exception.h>

using namespace std;
using namespace sql;

int main(void)
{

    sql::Driver *driver;
    sql::Connection *con;

    cout << "connecting to mysql server....";
    driver = get_driver_instance();
    con = driver->connect("tcp://127.0.0.1:3306", "leandro", "root");  
    cout << "connected" << endl;

    delete con;

}

when I try to run the code above the following error:

/tmp/ccBhXaG2: In the "main" function: tempCodeRunnerFile.cpp:(.text+0x2f): reference not set to "get_driver_instance" collect2: error: Ld returned 1 Exit status

  • instead of putting a print of the code, put the same code.

  • gets all fucked up the includes when I try to put the code..

  • I put part of the code, part of includes was not possible.

  • Displaying the code was just a matter of formatting.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.