Allora dopo aver installato netbeans c++ e dopo aver installato mysql++ volevo provare ad eseguire il primo esempio contenuto nella cartella
mysql++-3.0.6/examples/simple1.cpp
per vedere se funziona il tutto.
Ecco il file:
/***********************************************************************
simple1.cpp - Example showing the simplest way to get data from a MySQL
table with MySQL++.
***********************************************************************/
#include "cmdline.h"
#include "./printdata.h"
#include "./mysql++.h"
#include <iostream>
#include <iomanip>
using namespace std;
int
main(int argc, char *argv[])
{
// Get database access parameters from command line
const char* db = 0, *server = 0, *user = 0, *pass = "";
if (!parse_command_line(argc, argv, &db, &server, &user, &pass)) {
return 1;
}
// Connect to the sample database.
mysqlpp::Connection conn(false);
if (conn.connect(db, server, user, pass)) {
// Retrieve a subset of the sample stock table set up by resetdb
// and display it.
mysqlpp::Query query = conn.query("select item from stock");
if (mysqlpp::StoreQueryResult res = query.store()) {
cout << "We have:" << endl;
for (size_t i = 0; i < res.num_rows(); ++i) {
cout << '\t' << res[i][0] << endl;
}
}
else {
cerr << "Failed to get item list: " << query.error() << endl;
return 1;
}
return 0;
}
else {
cerr << "DB connection failed: " << conn.error() << endl;
return 1;
}
}
ed eco gli errori che da in esecuzione dopo averlo eseguito da netbeans
Running "/usr/bin/make -f Makefile CONF=Debug" in /Users/marko/Desktop/Tirocinio/Programmi/Esempio/Esempio
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
mkdir -p dist/Debug/GNU-MacOSX
g++ -o dist/Debug/GNU-MacOSX/esempio build/Debug/GNU-MacOSX/simple1.o
Undefined symbols:
"mysqlpp::Connection::connect(char const*, char const*, char const*, char const*, unsigned int)", referenced from:
_main in simple1.o
"parse_command_line(int, char**, char const**, char const**, char const**, char const**, char const*)", referenced from:
_main in simple1.o
"mysqlpp::Query::store(mysqlpp::SQLTypeAdapter const&)", referenced from:
mysqlpp::Query::store() in simple1.o
"mysqlpp::Connection::query(char const*)", referenced from:
_main in simple1.o
"mysqlpp::Query::str(mysqlpp::SQLQueryParms&)", referenced from:
mysqlpp::Query::store() in simple1.o
"mysqlpp::Connection::Connection(bool)", referenced from:
_main in simple1.o
"mysqlpp::SQLTypeAdapter::SQLTypeAdapter(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)", referenced from:
mysqlpp::Query::store() in simple1.o
"mysqlpp::Query::error() const", referenced from:
_main in simple1.o
"mysqlpp::Connection::error() const", referenced from:
_main in simple1.o
"mysqlpp::Connection::~Connection()", referenced from:
_main in simple1.o
_main in simple1.o
"mysqlpp::operator<<(std::basic_ostream<char, std::char_traits<char> >&, mysqlpp::String const&)", referenced from:
_main in simple1.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [dist/Debug/GNU-MacOSX/esempio] Error 1
make: *** [.build-impl] Error 2
Build failed. Exit value 2.
Please helpme sto sbattendo la testa da una settimana . Un grazie in anticipo per le risposte