• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

c++ und mysql

hi.

ich wollte mal fragen, ob irgend jemand schon erfahrungen gemacht hat, um von c++ auf eine mysql db zuzugreifen, ohne odbc treiber oder sonstiges?
(das ganze unter linux/unix)

ich hab jetzt schon die mysql++.h mir besorgt, also mit dem ganzen projekt von mysql.com, aber irgendwie will der beim compilieren nicht so wie er soll!

also es steht auch net viel drin, nur ne main mit einem cout hello world, und halt die mysql++.h includiert, aber kommen tut das alles:

Code:
In file included from /usr/include/mysql++/connection.h:40,
                 from /usr/include/mysql++/mysql++.h:54,
                 from main.cpp:2:
/usr/include/mysql++/defs.h:34:19: mysql.h: No such file or directory
In file included from /usr/include/mysql++/connection.h:40,
                 from /usr/include/mysql++/mysql++.h:54,
                 from main.cpp:2:
/usr/include/mysql++/defs.h:66: error: `MYSQL_FIELD' does not name a type
In file included from /usr/include/mysql++/mysql++.h:54,
                 from main.cpp:2:
/usr/include/mysql++/connection.h:142: error: `my_bool' has not been declared
/usr/include/mysql++/connection.h:159: error: `my_bool' has not been declared
/usr/include/mysql++/connection.h:355: error: `st_mysql_options' does not name a type
/usr/include/mysql++/connection.h:422: error: `my_ulonglong' does not name a type
/usr/include/mysql++/connection.h:433: error: `my_ulonglong' does not name a type
/usr/include/mysql++/connection.h:483: error: expected `;' before '(' token
/usr/include/mysql++/connection.h:540: error: `MYSQL' does not name a type
/usr/include/mysql++/connection.h: In member function `void mysqlpp::Connection::close()':
/usr/include/mysql++/connection.h:167: error: `mysql_' undeclared (first use this function)
/usr/include/mysql++/connection.h:167: error: (Each undeclared identifier is reported only once for each function it appears in.)
/usr/include/mysql++/connection.h:167: error: `mysql_close' undeclared (first use this function)
/usr/include/mysql++/connection.h: In member function `const char* mysqlpp::Connection::error()':
/usr/include/mysql++/connection.h:224: error: `mysql_' undeclared (first use this function)
/usr/include/mysql++/connection.h:224: error: `mysql_error' undeclared (first use this function)
/usr/include/mysql++/connection.h: In member function `int mysqlpp::Connection::errnum()':
/usr/include/mysql++/connection.h:231: error: `mysql_' undeclared (first use this function)
/usr/include/mysql++/connection.h:231: error: `mysql_errno' undeclared (first use this function)
/usr/include/mysql++/connection.h: In member function `int mysqlpp::Connection::refresh(unsigned int)':
/usr/include/mysql++/connection.h:243: error: `mysql_' undeclared (first use this function)
/usr/include/mysql++/connection.h:243: error: `mysql_refresh' undeclared (first use this function)
/usr/include/mysql++/connection.h: In member function `int mysqlpp::Connection::ping()':
/usr/include/mysql++/connection.h:256: error: `mysql_' undeclared (first use this function)
/usr/include/mysql++/connection.h:256: error: `mysql_ping' undeclared (first use this function)
/usr/include/mysql++/connection.h: In member function `int mysqlpp::Connection::kill(long unsigned int)':
/usr/include/mysql++/connection.h:265: error: `mysql_' undeclared (first use this function)
/usr/include/mysql++/connection.h:265: error: `mysql_kill' undeclared (first use this function)
/usr/include/mysql++/connection.h: In member function `std::string mysqlpp::Connection::client_info()':
/usr/include/mysql++/connection.h:273: error: `mysql_get_client_info' undeclared (first use this function)
/usr/include/mysql++/connection.h: In member function `std::string mysqlpp::Connection::host_info()':
/usr/include/mysql++/connection.h:284: error: `mysql_' undeclared (first use this function)
/usr/include/mysql++/connection.h:284: error: `mysql_get_host_info' undeclared (first use this function)
/usr/include/mysql++/connection.h: In member function `int mysqlpp::Connection::proto_info()':
/usr/include/mysql++/connection.h:293: error: `mysql_' undeclared (first use this function)
/usr/include/mysql++/connection.h:293: error: `mysql_get_proto_info' undeclared (first use this function)
/usr/include/mysql++/connection.h: In member function `std::string mysqlpp::Connection::server_info()':
/usr/include/mysql++/connection.h:301: error: `mysql_' undeclared (first use this function)
/usr/include/mysql++/connection.h:301: error: `mysql_get_server_info' undeclared (first use this function)
/usr/include/mysql++/connection.h: In member function `std::string mysqlpp::Connection::stat()':
/usr/include/mysql++/connection.h:312: error: `mysql_' undeclared (first use this function)
/usr/include/mysql++/connection.h:312: error: `mysql_stat' undeclared (first use this function)
In file included from /usr/include/mysql++/result.h:34,
                 from /usr/include/mysql++/query.h:36,
                 from /usr/include/mysql++/mysql++.h:55,
                 from main.cpp:2:
/usr/include/mysql++/fields.h: At global scope:
/usr/include/mysql++/fields.h:41: error: `Field' was not declared in this scope
/usr/include/mysql++/fields.h:42: error: template argument 2 is invalid
/usr/include/mysql++/fields.h:42: error: template argument 3 is invalid
/usr/include/mysql++/fields.h:54: error: expected `;' before '&' token
/usr/include/mysql++/fields.h:57: error: expected `;' before '&' token
/usr/include/mysql++/fields.h:62: error: expected `;' before "size_type"
/usr/include/mysql++/fields.h:62: error: `size_type' does not name a type
In file included from /usr/include/mysql++/coldata.h:43,
                 from /usr/include/mysql++/field_names.h:31,
                 from /usr/include/mysql++/result.h:35,
                 from /usr/include/mysql++/query.h:36,
                 from /usr/include/mysql++/mysql++.h:55,
                 from main.cpp:2:
/usr/include/mysql++/type_info.h:142: error: expected `)' before "t"
/usr/include/mysql++/type_info.h:148: error: expected `,' or `...' before '&' token
/usr/include/mysql++/type_info.h:299: error: expected `;' before '(' token
/usr/include/mysql++/type_info.h:340: error: expected `)' before "t"
/usr/include/mysql++/type_info.h:340: error: expected `,' or `;' before "t"
/usr/include/mysql++/type_info.h:346: error: expected `,' or `...' before '&' token
/usr/include/mysql++/type_info.h: In constructor `mysqlpp::mysql_type_info::mysql_type_info(int)':
/usr/include/mysql++/type_info.h:348: error: `f' undeclared (first use this function)
/usr/include/mysql++/type_info.h:348: error: `UNSIGNED_FLAG' undeclared (first use this function)
/usr/include/mysql++/type_info.h:349: error: `NOT_NULL_FLAG' undeclared (first use this function)
/usr/include/mysql++/type_info.h:349: error: `type' undeclared (first use this function)
In file included from /usr/include/mysql++/result.h:39,
                 from /usr/include/mysql++/query.h:36,
                 from /usr/include/mysql++/mysql++.h:55,
                 from main.cpp:2:
/usr/include/mysql++/row.h: At global scope:
/usr/include/mysql++/row.h:66: error: expected `,' or `...' before '&' token
In file included from /usr/include/mysql++/query.h:36,
                 from /usr/include/mysql++/mysql++.h:55,
                 from main.cpp:2:
/usr/include/mysql++/result.h:77: error: expected `)' before '*' token
/usr/include/mysql++/result.h:94: error: expected `;' before '*' token
/usr/include/mysql++/result.h:103: error: expected `;' before "Row"
/usr/include/mysql++/result.h:133: error: expected `;' before '&' token
/usr/include/mysql++/result.h:139: error: expected `;' before "void"
/usr/include/mysql++/result.h:295: error: expected `;' before '&' token
/usr/include/mysql++/result.h:305: error: expected `;' before "bool"
/usr/include/mysql++/result.h:319: error: expected `;' before '*' token
/usr/include/mysql++/result.h: In constructor `mysqlpp::ResUse::ResUse()':
/usr/include/mysql++/result.h:68: error: class `mysqlpp::ResUse' does not have any field named `result_'
/usr/include/mysql++/result.h: In member function `mysqlpp::Row mysqlpp::ResUse::fetch_row()':
/usr/include/mysql++/result.h:105: error: `result_' undeclared (first use this function)
/usr/include/mysql++/result.h:113: error: `MYSQL_ROW' undeclared (first use this function)
/usr/include/mysql++/result.h:113: error: expected `;' before "row"
/usr/include/mysql++/result.h:114: error: `mysql_fetch_lengths' undeclared (first use this function)
/usr/include/mysql++/result.h:115: error: `row' undeclared (first use this function)
/usr/include/mysql++/result.h: In member function `long unsigned int* mysqlpp::ResUse::fetch_lengths() const':
/usr/include/mysql++/result.h:129: error: `result_' undeclared (first use this function)
/usr/include/mysql++/result.h:129: error: `mysql_fetch_lengths' undeclared (first use this function)
/usr/include/mysql++/result.h: In member function `void mysqlpp::ResUse::field_seek(int)':
/usr/include/mysql++/result.h:141: error: `result_' undeclared (first use this function)
/usr/include/mysql++/result.h:141: error: `mysql_field_seek' undeclared (first use this function)
/usr/include/mysql++/result.h: In member function `int mysqlpp::ResUse::num_fields() const':
/usr/include/mysql++/result.h:147: error: `result_' undeclared (first use this function)
/usr/include/mysql++/result.h:147: error: `mysql_num_fields' undeclared (first use this function)
/usr/include/mysql++/result.h: In member function `void mysqlpp::ResUse::purge()':
/usr/include/mysql++/result.h:163: error: `result_' undeclared (first use this function)
/usr/include/mysql++/result.h:164: error: `mysql_free_result' undeclared (first use this function)
/usr/include/mysql++/result.h: In member function `mysqlpp::ResUse::operator bool() const':
/usr/include/mysql++/result.h:192: error: `result_' undeclared (first use this function)
/usr/include/mysql++/result.h: In member function `bool mysqlpp::ResUse::operator==(const mysqlpp::ResUse&) const':
/usr/include/mysql++/result.h:307: error: `result_' undeclared (first use this function)
/usr/include/mysql++/result.h:307: error: 'const class mysqlpp::ResUse' has no member named 'result_'
/usr/include/mysql++/result.h: In member function `bool mysqlpp::ResUse::operator!=(const mysqlpp::ResUse&) const':
/usr/include/mysql++/result.h:314: error: `result_' undeclared (first use this function)
/usr/include/mysql++/result.h:314: error: 'const class mysqlpp::ResUse' has no member named 'result_'
/usr/include/mysql++/result.h: At global scope:
/usr/include/mysql++/result.h:355: error: expected `)' before '*' token
/usr/include/mysql++/result.h:400: error: `my_ulonglong' does not name a type
/usr/include/mysql++/result.h: In member function `const mysqlpp::Row mysqlpp::Result::fetch_row() const':
/usr/include/mysql++/result.h:378: error: `result_' undeclared (first use this function)
/usr/include/mysql++/result.h:386: error: `MYSQL_ROW' undeclared (first use this function)
/usr/include/mysql++/result.h:386: error: expected `;' before "row"
/usr/include/mysql++/result.h:387: error: `mysql_fetch_lengths' undeclared (first use this function)
/usr/include/mysql++/result.h:388: error: `row' undeclared (first use this function)
/usr/include/mysql++/result.h: In member function `void mysqlpp::Result::data_seek(mysqlpp::uint) const':
/usr/include/mysql++/result.h:411: error: `result_' undeclared (first use this function)
/usr/include/mysql++/result.h:411: error: `mysql_data_seek' undeclared (first use this function)
/usr/include/mysql++/result.h: In member function `virtual unsigned int mysqlpp::Result::size() const':
/usr/include/mysql++/result.h:417: error: `num_rows' undeclared (first use this function)
/usr/include/mysql++/result.h: In member function `unsigned int mysqlpp::Result::rows() const':
/usr/include/mysql++/result.h:423: error: `num_rows' undeclared (first use this function)
/usr/include/mysql++/result.h: At global scope:
/usr/include/mysql++/result.h:457: error: `my_ulonglong' does not name a type
/usr/include/mysql++/result.h:458: error: `my_ulonglong' does not name a type
/usr/include/mysql++/result.h: In member function `mysqlpp::ResUse& mysqlpp::ResUse::operator=(const mysqlpp::ResUse&)':
/usr/include/mysql++/result.h:627: error: 'const class mysqlpp::ResUse' has no member named 'result_'
In file included from /usr/include/mysql++/mysql++.h:55,
                 from main.cpp:2:
/usr/include/mysql++/query.h: At global scope:
/usr/include/mysql++/query.h:698: error: `my_ulonglong' does not name a type
/usr/include/mysql++/query.h:699: error: `my_ulonglong' does not name a type
/usr/include/mysql++/query.h: In member function `void mysqlpp::Query::storein_sequence(Sequence&, const char*)':
/usr/include/mysql++/query.h:730: error: `MYSQL_ROW' undeclared (first use this function)
/usr/include/mysql++/query.h:730: error: expected `;' before "d"
/usr/include/mysql++/query.h:731: error: `d' undeclared (first use this function)
/usr/include/mysql++/query.h:733: error: 'class mysqlpp::ResUse' has no member named 'raw_result'
/usr/include/mysql++/query.h:733: error: there are no arguments to `mysql_fetch_lengths' that depend on a template parameter, so a declaration of `mysql_fetch_lengths' must be available
/usr/include/mysql++/query.h:733: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/include/mysql++/query.h: In member function `void mysqlpp::Query::storein_set(Set&, const char*)':
/usr/include/mysql++/query.h:755: error: `MYSQL_ROW' undeclared (first use this function)
/usr/include/mysql++/query.h:755: error: expected `;' before "d"
/usr/include/mysql++/query.h:756: error: `d' undeclared (first use this function)
/usr/include/mysql++/query.h:758: error: 'class mysqlpp::ResUse' has no member named 'raw_result'
/usr/include/mysql++/query.h:758: error: there are no arguments to `mysql_fetch_lengths' that depend on a template parameter, so a declaration of `mysql_fetch_lengths' must be available
main.cpp: In function `int main()':
main.cpp:15: error: `argc' undeclared (first use this function)
main.cpp:15: error: `argv' undeclared (first use this function)
main.cpp:15: error: `connect_to_db' undeclared (first use this function)
main.cpp:31: error: `utf8trans' undeclared (first use this function)
 

nbkr

Guru
Dem fehlen die Headerdateien unter /usr/include/mysql++ - hast Du die auch runtergeladen und dahin kopiert?
 
OP
M

mitch-geht-ab

Member
ja sicher! wie gesagt ich hab das packet installiert!
die dateien bei denen er meckert, die gibt es auch alle!

es sieht halt so aus, als wenn ich fehler im code hätte, aber da steht ja noch garnix!

oder muss man auch ein "using sql irgendwas" schreiben??
 

jwartenb

Member
Mit aller Vorsicht, da meine Programmiererzeit schon lange vorbei ist:
Etwa in Zeile 4 steht:
Code:
/usr/include/mysql++/defs.h:34:19: mysql.h: No such file or directory
Daraus würde ich schließen, dass er die Datei mysql.h nicht findet. Ist diese Datei wirklich da bzw. im Suchpfad für die includes ?
Möglicherweise ist mysql.h Bestandteil des DEV-Paketes von mysql. Ist dieses Paket installiert ?

Gruß
Jochen
 
Oben