MySQL Forums
Forum List  »  Connector/C++

Error: boost/shared_ptr.hpp: No such file or directory
Posted by: aitor sanchez
Date: February 05, 2018 09:41AM

it's my first time using this connector so I'm trying an example taken from MySQL site. I'm trying to see how to work with this connector to build a new C++ program, get in touch with the methodology, variables, headers, etc, but everytime I try to compile the code (copied below) I got the error "[Error] boost/shared_ptr.hpp: No such file or directory". Do you know why? what is that boost folder/package? Is it coming with the connector?

These are the info you could need to help me:

1) Compiler/IDE: DEV C++ v5.11
2) MySQL Connector: mysql-connector-c++-1.1.9-winx64
3) Windows 7 64b (I know it's old but I need to develop this using that version of Windows)
C:\Users\9888766\Documents\MySQL_Test\mysql-connector\include\mysql_connection.h [Error] boost/shared_ptr.hpp: No such file or directory

CODE/PROGRAM (taken from MYSQL site):

/* Standard C++ includes */
#include <stdlib.h>
#include <iostream>

Include directly the different
headers from cppconn/ and mysql_driver.h + mysql_util.h
(and mysql_connection.h). This will reduce your build time!
#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)
cout << endl;
cout << "Running 'SELECT 'Hello World!' »
AS _message'..." << endl;

try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;

/* Create a connection */
driver = get_driver_instance();
con = driver->connect("tcp://", "root", "root");
/* Connect to the MySQL test database */

stmt = con->createStatement();
res = stmt->executeQuery("SELECT 'Hello World!' AS _message");
while (res->next()) {
cout << "\t... MySQL replies: ";
/* Access column data by alias or column name */
cout << res->getString("_message") << endl;
cout << "\t... MySQL says it again: ";
/* Access column data by numeric offset, 1 is the first column */
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;


Options: ReplyQuote

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.