I’ve been trying to connect to MySQL and I’ve looked through various topics and asked ChatGPT for help but nothing solved it, I managed to include header files but the error I can’t solve right now is
C:Program FilesJetBrainsCLion 2023.3.2binmingwbin/ld.exe: C:/Program Files/MySQL/MySQL Connector C++ 9.0/include/jdbc/cppconn/driver.h:86: undefined reference to `check(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Here’s main.cpp
#include <stdlib.h>
#include <iostream>
#include <mysql_connection.h>
#include <driver.h>
#include <exception.h>
#include <resultset.h>
#include <statement.h>
using namespace sql;
int main(void){
sql::Driver *driver;
sql::Connection *con;
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306","root","pass");
return 0;
}
It’s just simple connecting to the database, I wanted to sort this out first.
This is when the error leads me
inline static void check_lib()
{
check(std::string{});
check(std::map<std::string,std::string>{});
}
undefined reference to `check(std::map<std::__cxx11::basic_string<char, std::char_traits…