Przy połączeniu z bazą danych mysql przez c++ wyskakują błędy.

0

Po wywołaniu tego kodu:

 
#include <stdlib.h>
#include <iostream>
#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)
{
	try
	{
		sql::Driver *driver;
		sql::Connection *con;
		sql::Statement *stmt;
		sql::ResultSet *res;


		driver = get_driver_instance();
		con = driver->connect("tcp://127.0.0.1:3306", "root", "root");

		con->setSchema("tabela");

		stmt = con->createStatement();
		res = stmt->executeQuery("SELECT * FROM test");
		while (res->next())
		{
			cout << "\t... MySQL replies: ";

			cout << res->getString("_message") << endl;
			cout << "\t... MySQL says it again: ";

			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 0;
}

Wyskakują mi błędy podane w załączniku.

Zainstalowałem bibliotekę boost według poradnika:

Od razu mówię, że kod nie jest mój.

Co robić?

Pozdrawiam.

0

Nie dolinkowałeś libek.

0

Mogłbyś powiedzieć co mam zrobić w takiej sytuacji ....szczegółowo? Pozdrawiam ;).

0

Project -> Properties -> Linker -> General -> Additional Library Directories -> Tutaj ścieżka do folderu lib z libami z biblioteki
(Chyba o to chodzi)

0

A oglądałeś film? ;] Oczywiście spróbuję jescze raz :)

0

Nie działa :/

1 użytkowników online, w tym zalogowanych: 0, gości: 1