From: Greg T. <gt...@CL...> - 2005-07-21 21:07:57
|
I'm still very new to C++ so I'm probably doing this all wrong, but I was=20 modifying the example program to specify a host/user/db and this is what I= =20 did: int main() { // The full format for the Connection constructor is // Connection(cchar *db, cchar *host=3D"", // cchar *user=3D"", cchar *passwd=3D"") // You may need to specify some of them if the database is not on // the local machine or your database username is not the same as your // login name, etc.. try { const char dbV =3D "test"; const char hostV =3D "localhost"; const char userV =3D "root"; const char passwdV =3D "somepassword"; mysqlcppapi::Connection(&dbV, &hostV, &userV, &passwdV) con; I get the following error on compile: gtaylor@devbox1:~/mysql/example/src$ make g++ -DHAVE_CONFIG_H -I. -I. -I.. -g -O2=20 =2DI/usr/local/include/mysqlcppapi-2.0 -I/usr/local/lib/mysqlcppapi-2.0/inc= lude=20 =2DI/usr/mysql/include -c simple1.cc simple1.cc: In function `int main()': simple1.cc:17: error: invalid conversion from `const char*' to `char' simple1.cc:18: error: invalid conversion from `const char*' to `char' simple1.cc:19: error: invalid conversion from `const char*' to `char' simple1.cc:20: error: invalid conversion from `const char*' to `char' simple1.cc:22: error: no matching function for call to=20 `mysqlcppapi::Connection ::Connection(const char*, const char*, const char*, const char*)' /usr/local/include/mysqlcppapi-2.0/mysqlcppapi/Connection.h:32: error:=20 candidates are: mysqlcppapi::Connection::Connection(const mysqlcppapi::Connection&) /usr/local/include/mysqlcppapi-2.0/mysqlcppapi/Connection.h:29: error: mysqlcppapi::Connection::Connection() simple1.cc:22: error: parse error before `;' token simple1.cc:26: error: `con' undeclared (first use this function) simple1.cc:26: error: (Each undeclared identifier is reported only once for each function it appears in.) make: *** [simple1.o] Error 1 Any ideas? |