Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Error compiling programs with mysql++
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
cvk
Guru
Guru


Joined: 06 Jan 2003
Posts: 314
Location: Our house, in the middle of our street

PostPosted: Thu Oct 02, 2003 3:08 pm    Post subject: Error compiling programs with mysql++ Reply with quote

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
View user's profile Send private message
Starfox
Tux's lil' helper
Tux's lil' helper


Joined: 04 Sep 2002
Posts: 93

PostPosted: Fri Oct 03, 2003 12:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
cvk
Guru
Guru


Joined: 06 Jan 2003
Posts: 314
Location: Our house, in the middle of our street

PostPosted: Sat Oct 04, 2003 5:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
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