View previous topic :: View next topic |
Author |
Message |
cvk Guru
Joined: 06 Jan 2003 Posts: 314 Location: Our house, in the middle of our street
|
Posted: Thu Oct 02, 2003 3:08 pm Post subject: Error compiling programs with mysql++ |
|
|
I'm currently trying to connect to a mysql-db using mysql++ 1.7.9-r2, but I always get a weird error:
Code: | 15: Connection con("test");
16: Query query = con.query();
17: query << "select bar from baz"; |
Code: | * compiling sqltest.cpp (g++)
* sqltest.cpp:17: error: ISO C++ says that ` std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*) [with _Traits = std::char_traits<char>]' and ` SQLQuery& operator<<(SQLQuery&, const mysql_ColData<const_string>&)' are ambiguous even though the worst conversion for the former is better than the worst conversion for the latter
* sqltest.cpp:17: error: ISO C++ says that ` std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*) [with _Traits = std::char_traits<char>]' and ` SQLQuery& operator<<(SQLQuery&, const mysql_ColData<std::string>&)' are ambiguous even though the worst conversion for the former is better than the worst conversion for the latter
* *** Exited with status: 2 *** |
I've tried compiling it with gcc 3.3.1-r4 and gcc 3.2.3-r2 without any luck...
Regards,
Chris _________________ Adopt an unanswered post now. |
|
Back to top |
|
|
Starfox Tux's lil' helper
Joined: 04 Sep 2002 Posts: 93
|
Posted: Fri Oct 03, 2003 12:39 pm Post subject: |
|
|
Hi, please check your namespaces, i think i had a similar problem when using wrong namespaces! I that will not help try:
string str = "sqlstring";
query << str;
that always works for me.
bye fox |
|
Back to top |
|
|
cvk Guru
Joined: 06 Jan 2003 Posts: 314 Location: Our house, in the middle of our street
|
Posted: Sat Oct 04, 2003 5:47 pm Post subject: |
|
|
Code: | string sql="foo";
query << sql; |
It works now, but what should I check about my namespaces (c++ noob without a clue here )
Chris _________________ Adopt an unanswered post now. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|