Connect Mysql And Eclipse c++ [message #1703523] |
Sun, 02 August 2015 09:12  |
Eclipse User |
|
|
|
i trying to connect mysql database and eclipse c++ and i set everything but when i want to compile a program using data base this error massage appears:
"fatal error:boost/shared_ptr.hpp: no such file or directory"
*****************************************************
how can i fix it, there is no solution on the internet, and i really really really tired of searching about this.
my compiler: gcc
my os: windows 8.1
**********************************
here you can see my code:
#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>
#include <cppconn/prepared_statement.h>
using namespace std;
int main(void)
{
cout << endl;
cout << "Let's have MySQL count from 10 to 1..." << endl;
try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
sql::PreparedStatement *pstmt;
/* Create a connection */
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "root", "37975");
/* Connect to the MySQL test database */
con->setSchema("test");
stmt = con->createStatement();
stmt->execute("DROP TABLE IF EXISTS test");
stmt->execute("CREATE TABLE test(id INT)");
delete stmt;
/* '?' is the supported placeholder syntax */
pstmt = con->prepareStatement("INSERT INTO test(id) VALUES (?)");
for (int i = 1; i <= 10; i++) {
pstmt->setInt(1, i);
pstmt->executeUpdate();
}
delete pstmt;
/* Select in ascending order */
pstmt = con->prepareStatement("SELECT id FROM test ORDER BY id ASC");
res = pstmt->executeQuery();
/* Fetch in reverse = descending order! */
res->afterLast();
while (res->previous())
cout << "\t... MySQL counts: " << res->getInt("id") << endl;
delete res;
delete pstmt;
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 EXIT_SUCCESS;
}
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Connect Mysql And Eclipse c++ [message #1704246 is a reply to message #1704177] |
Sun, 09 August 2015 15:15  |
Eclipse User |
|
|
|
David Wegener wrote on Sat, 08 August 2015 00:17On 08/07/2015 03:12 AM, Danial Atash wrote:
> i see it is dont compile and i see these errors:
> - Description Resource Path Location Type
> fatal error: boost/shared_ptr.hpp: No such file or directory
> Working line 31, external location:
> D:\Programs\Programming\MySQL\Connector
> C++\include\mysql_connection.h C/C++ Problem
>
The compiler is looking for the boost/shared_ptr.hpp file in an Include
path subdirectory named boost. One of the include directories you added
ends with boost. Make sure that you aren't adding the wrong directory
to the path. If the shared_ptr.hpp file is in
"D:\Programs\Programming\boost_1_57_0\boost" that you added, then you
need to back this path entry up a level as
"D:\Programs\Programming\boost_1_57_0". The compiler with then look in
the boost subdirectory and find the header file.
If someone can get him to show the status of his Include block it would be easy to identify if he has his includes configured correctly. The code he posted works fine.
To me that problem appears to be simple, but can't resolve it without knowing what the IDE is showing as a status.
-- L. James
--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames
|
|
|
Powered by
FUDForum. Page generated in 0.06479 seconds