无法在dll libmysql.dll中找到过程入口点mysql_get_option

时间:2015-11-17 19:29:45

标签: c++ mysql dll

我只是使用mysql站点的示例代码。如果我在调试中执行它,该程序将编译并运行。如果我在发布中编译它会给我标题中的错误。我从oracle网站下载了所有的连接器和服务器,所以一切都是最新的。我甚至编译了最新版本的c ++连接器和c连接器。我已经对此进行了大量搜索并尝试了他们所说的,但无法解决这个问题。我看到的lib和dll文件中列出了mysql_get_option函数。我确保我的计算机上没有丢失的dll或lib文件。我检查了系统路径变量,以确保它没有指向某个随机区域。我正在使用Vs2013。

请帮助我试着解决这个问题一个星期,我的大脑即将爆炸!谢谢你的任何建议。

P.S。 我作为一个爱好编程,所以我很可能忽略了一些微不足道的事情。

    /* Copyright 2008, 2010, Oracle and/or its affiliates. All rights reserved.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.

There are special exceptions to the terms and conditions of the GPL
as it is applied to this software. View the full text of the
exception in file EXCEPTIONS-CONNECTOR-C++ in the directory of this
software distribution.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

/* 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 World0000........ 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("*****", "*****", "*****");
        /* Connect to the MySQL test database */
        //con->setReadOnly(true);
        con->setSchema(*****);
        cout << "\nHere!";
        stmt = con->createStatement();
        res = stmt->executeQuery("SELECT DISTINCT eqdkp10_raid_attendees.raid_id, eqdkp10_raids.raid_value \
                                  FROM eqdkp10_raids LEFT JOIN eqdkp10_raid_attendees ON eqdkp10_raids.raid_id \
                                  = eqdkp10_raid_attendees.raid_id AND eqdkp10_raid_attendees.member_id=2");
        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 fata 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;
    system("PAUSE");
    return EXIT_SUCCESS;
}

1 个答案:

答案 0 :(得分:1)

我用Google搜索了您的帖子标题,找到了这个链接:http://www.linuxtalks.net/mysql-community-server-5-7-4-m14-has-been-released/

如果您搜索 mysql_get_option 的页面,您会看到他们修复了这个已知错误。如果您正在使用VS2013,那么您的库版本可能包含此错误,因为该页面指的是2014年的版本。