KDevelop kompiliert mysql++ nicht richtig? reference?

MastermindHWI

Grünschnabel
Hallo zusammen,

vorhin habe ich mysql++ unter opensuse 10.3 installiert.
Im nächsten Schritt dann noch eben das Beispielscript in ein neues Project innerhalb von KDevelop eingefügt, die Linkerflags gesetzt und nun versuche und google ich schon eine ganze Weile, leider ohne Erfolg.
Ich hoffe, ihr habt eine Idee!

Der Code:
Code:
#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;
	}
}



Die Fehlermeldung:
Code:
cd '/home/mastermind/sq' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake 
gmake all-recursive
Making all in src
Linken der Datei sq (libtool)
Linken der Datei sq (g++)
sq.o: In function `main':
sq.cpp:(.text+0x1de): undefined reference to `parse_command_line(int, char**, char const**, char const**, char const**, char const**, char const*)'
collect2: ld returned 1 exit status
gmake[2]: *** [sq] Fehler 1
gmake[1]: *** [all-recursive] Fehler 1
gmake: *** [all] Fehler 2
*** Beendet mit Status: 2 ***


Vielen Dank im Voraus!
Gruss
Tino
 
Hi.

Die Funktion parse_command_line hat doch (vermutlich) gar nichts mit mysql++ zu tun. Die müßte doch extra noch (evtl. in cmdline.c[pp] ?) implementiert sein?

Gruß

PS: Auf der Seite http://tangentsoft.net/mysql++/doc/html/userman/tutorial.html#examples steht: The only thing that isn’t explicit in the code above is that we delegate command line argument parsing to parse_command_line() in the excommon module. This function exists to give the examples a consistent interface, not to hide important details. You can treat it like a black box: it takes argc and argv as inputs and sends back database connection parameters.

Du mußt also noch das ominöse excommon Modul einbinden.
 
Zurück