小编riz*_*917的帖子

MySQL的连接器-C++ - 'get_driver_instance' 不是的成员"SQL :: MySQL的

我是c ++的初学者,并认为我要学习的唯一方法就是弄脏一些代码.我正在尝试构建一个连接到mysql数据库的程序.我在linux上使用g ++.没有想法.

我运行"make",这是我的错误:

hello.cpp:38: error: ‘get_driver_instance’ is not a member of ‘sql::mysql’
make: *** [hello.o] Error 1
Run Code Online (Sandbox Code Playgroud)

这是我的代码,包括makefile.任何帮助都会很棒!提前致谢

###BEGIN hello.cpp###

#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <stdexcept>

#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>

#define EXAMPLE_HOST "localhost"
#define EXAMPLE_USER "root"
#define EXAMPLE_PASS ""
#define EXAMPLE_DB "world"

using namespace std;
using namespace sql::mysql;

int main(int argc, const char **argv)
{   

    string url(argc >= 2 ? argv[1] : EXAMPLE_HOST);
    const string user(argc >= 3 ? …
Run Code Online (Sandbox Code Playgroud)

c++ mysql g++

8
推荐指数
1
解决办法
9269
查看次数

标签 统计

c++ ×1

g++ ×1

mysql ×1