several errors

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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// 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
Hi there,

You are getting linker errors, which are often because you are not including a shared library (in your case, mysql connector) in your compilation.

This post describes how to include a dependency in your project: http://stackoverflow.com/questions/7845886/linking-dll-in-visual-studio

Hope that helps.

All the best,
NwN
as my windows 7 x64 is owed to the program in 64-bit, that's all
error mio
Topic archived. No new replies allowed.