Well, I do not find solution, if any help me would be great, here the code and where the error log
is visual c + + 2012
// ver1.1.cpp: define el punto de entrada de la aplicación de consola.
//
#include "stdafx.h"
/*
examples/standalone_example_docs1.cpp
*/
/* 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>
#pragma comment(lib,"mysqlcppconn.lib")
#pragma comment(lib,"libmysql.lib")
using namespace std;
int main(void)
{
cout << endl;
cout << "Running 'SELECT 'Hello World!' 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("tcp://127.0.0.1:3306", "root", "root");
/* Connect to the MySQL test database */
con->setSchema("test");
stmt = con->createStatement();
res = stmt->executeQuery("SELECT 'Hello World!' AS _message");
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;
return EXIT_SUCCESS;
}
log
Compilación iniciada a las 04/10/2013 23:26:24.
1>Proyecto "C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\ver1.1\ver1.1.vcxproj" en el nodo 2 (Build destinos).
1>Link:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\Release\ver1.1.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files\MySQL\Connector C++ 1.1.3\lib\opt" /LIBPATH:"C:\Program Files\MySQL\MySQL Server 5.6\lib" mysqlcppconn.lib libmysql.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\Release\ver1.1.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\Release\ver1.1.lib" /MACHINE:X86 /SAFESEH Release\stdafx.obj
Release\ver1.1.obj
1>ver1.1.obj : error LNK2001: símbolo externo __imp__get_driver_instance sin resolver
1>ver1.1.obj : error LNK2001: símbolo externo "__declspec(dllimport) public: int __thiscall sql::SQLException::getErrorCode(void)const " (__imp_?getErrorCode@SQLException@sql@@QBEHXZ) sin resolver
1>ver1.1.obj : error LNK2001: símbolo externo "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __thiscall sql::SQLException::getSQLState(void)const " (__imp_?getSQLState@SQLException@sql@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) sin resolver
1>ver1.1.obj : error LNK2001: símbolo externo "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __thiscall sql::SQLString::asStdString(void)const " (__imp_?asStdString@SQLString@sql@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) sin resolver
1>ver1.1.obj : error LNK2001: símbolo externo "__declspec(dllimport) public: __thiscall sql::SQLString::SQLString(char const * const)" (__imp_??0SQLString@sql@@QAE@QBD@Z) sin resolver
1>ver1.1.obj : error LNK2001: símbolo externo "__declspec(dllimport) public: __thiscall sql::SQLString::~SQLString(void)" (__imp_??1SQLString@sql@@QAE@XZ) sin resolver
1>C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\Release\ver1.1.exe : fatal error LNK1120: 6 externos sin resolver
1>Compilación del proyecto terminada "C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\ver1.1\ver1.1.vcxproj" (Build destinos) -- ERROR.
ERROR al compilar.
Tiempo transcurrido 00:00:00.18