mysqlcppconn.dll无法找到或打开PDB文件

时间:2012-11-26 06:48:49

标签: mysql visual-c++ visual-studio-2012 mysql-connector

我正在尝试用VC ++构建一个简单的MySQL数据库应用程序并遇到了一些小问题。

我正在使用MySQL Connector C ++ 1.1.0和Visual Studio 2012(如果重要,则为Premium)

// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <memory>
#include <string>
#include <stdexcept>

/* MySQL Connector/C++ specific headers */
#include <driver.h>
#include <connection.h>
#include <statement.h>
#include <prepared_statement.h>
#include <resultset.h>
#include <metadata.h>
#include <resultset_metadata.h>
#include <exception.h>
#include <warning.h>

#include "mysql_driver.h"
#include "mysql_connection.h"

#define DBHOST "tcp://127.0.0.1:3306"
#define USER "root"
#define PASSWORD "root"
#define DATABASE "test"

using namespace std;
using namespace sql;

int _tmain(int argc, char *argv[]){
    // I'm alive
    cout << "Hello World!" << endl;

    // necessary variables
    Driver *driver;
    Connection* con;
    Statement *stmt;
    ResultSet *res;
    /*PreparedStatement *prep_stmt;
    Savepoint *savept;*/

    //
    driver = get_driver_instance();

    // Connect to DB
    con = driver->connect("tcp//127.0.0.1:3306", "root", "root");

    // 
    con->setAutoCommit(false);

    // set schema
    con->setSchema("world");

    // create statement object
    stmt = con->createStatement();

    // alert user
    cout << "Executing query: \"SELECT * FROM city\"" << endl;

    // execute query "SELECT * FROM city"
    res = stmt->executeQuery("SELECT * FROM city");

    // alert user
    cout << "\tRetrieved " << res->rowsCount() << " row(s)." << endl;

    // fetch data
    while(res->next()){
        cout << res->getString("Name") << endl;
    }

    system("pause");

    // Clean up
    delete res;
    delete stmt;
    /*delete prep_stmt;*/
    con->close();
    delete con;

    return 0;
} // end main

我在调试模式下将其构建为Win32控制台应用程序,将配置更改为x64并将mysqlcppconn.dll移动到输出目录。 代码正在构建(*我认为我已经正确添加了必要的包含目录以及其他库依赖项/相关路径)。但是,当我尝试运行它时,我得到以下调试输出:

'ConsoleApplication1.exe' (Win32): Loaded 'C:\Users\RBanerjee\Documents\Visual Studio 2012\Projects\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Users\RBanerjee\Documents\Visual Studio 2012\Projects\ConsoleApplication1\x64\Debug\mysqlcppconn.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\libmysql.dll'. Module was built without symbols.
'ConsoleApplication1.exe' (Win32): Unloaded 'C:\Windows\System32\libmysql.dll'
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\System32\libmysql.dll'. Module was built without symbols.
'ConsoleApplication1.exe' (Win32): Unloaded 'C:\Windows\System32\libmysql.dll'
The program '[4172] ConsoleApplication1.exe' has exited with code -1073741701 (0xc000007b).

关于下一步该做什么,我有点迷失,我真的只想开发一个可以连接到MySQL数据库并与之交互的Windows应用程序。我很感激这个问题的任何帮助或指向其他教程的指针。

由于 罗希特夏尔

0 个答案:

没有答案