I m writing an application in C++ (using Eclipse with Linux GCC) that s supposed to interact with my MySQL server. I ve downloaded the MySQL Connector C++ a, precompiled, and copied the files into the directories (/usr/lib, /usr/include). I ve referenced in in the GCC C++ Linker Section of the Project Properties in Eclipse ( "mysqlcppconn"). My code comes directly from the MySQL Reference (Hello World) except I removed error handling and the delete statements at the end (I m not even getting there so whats the point)
#include <stdlib.h>
#include <iostream>
#include "mysql_connection.h"
#include "mysql_driver.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
using namespace std;
int main(void)
{
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("test");
stmt = con->createStatement();
res = stmt->executeQuery("SELECT Hello World! AS _message");
while (res->next())
{
cout << " ... MySQL replies: ";
cout << res->getString("_message") << endl;
cout << " ... MySQL says it again: ";
cout << res->getString(1) << endl;
}
return EXIT_SUCCESS;
}
现在,我汇编了这封信,给我留下了错误1,而男子页说,这意味着我需要重新编辑我的包裹。 我对它进行了审判,但却没有工作。
我似乎在任何地方都点击了死亡目标。 谁能告诉我如何解决这一问题? (面包可以真正告诉我我我我应该做些什么。) 任何人在我有错的地方,都没有任何假肢/假肢?
Edit - Chagned the Code a bit, but the general concept is the same.
最新情况——如果我使用终点站而不是排泄物,它告诉我,问题显然在于连接者想要校正++。