Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 45807 - Impossible to compile c++ applications
Summary: Impossible to compile c++ applications
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-26 07:23 UTC by Voicu Liviu
Modified: 2004-09-03 11:39 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
MySQL++ Example (mysql++_example.cpp,1.56 KB, text/plain)
2004-03-26 14:15 UTC, Curtis Magyar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Voicu Liviu 2004-03-26 07:23:26 UTC
I run:
---------
c++ -Wno-deprecated -lmysqlclient qDB.cpp -o qDB -L/usr/lib/mysql -L/usr/lib/libsqlplus.so -I/usr/include/mysql -I/usr/include/mysql++

And I get:
--------------
qDB.cpp: In function `int main()':
qDB.cpp:20: 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
qDB.cpp:20: 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
make: *** [qDB] Error 1

Reproducible: Always
Steps to Reproduce:
1. emerge mysql++
2. create a c++ aplication that uses mysql++ API
3. compile it and you'll see it failes (if you have gcc 3.3.2)




liviu@starshooter newtMysql $ emerge info
Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r9, 2.6.3-gentoo-r1)
=================================================================
System uname: 2.6.3-gentoo-r1 i686 AMD Athlon(tm) XP 2600+
Gentoo Base System version 1.4.3.13
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.58-r1
Automake: sys-devel/automake-1.7.7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config
/usr/lib/mozilla/defaults/pref /usr/share/config
/usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox userpriv usersandbox"
GENTOO_MIRRORS="http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/
http://sunsite.cnlab-switch.ch/ftp/mirror/gentoo/
http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/
http://gentoo.tiscali.nl/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="3dnow X acpi alsa apm arts avi berkdb crypt cscope dga dvd encode esd flash
foomaticdb foreign-package foreign-sysvinit freetype gd gdbm ggz gif gnome gpm
gtk gtk2 gtkhtml imlib java javascript jpeg kde libg++ libwww mad mikmod mmx
motif mozcalendar mozilla moznoirc mozsvg mpeg mysql ncurses nls odbc oggvorbis
opengl openssh oss pam pdflib perl php png python qt qtmt quicktime readline
regexp samba sasl sdk sdl slang speedo speex spell sse ssl svga tcltk tcpd tetex
threads tiff truetype type1 unicode v4l vim-with-x wxwindows x86 xfs xml xml2
xmms xosd xv xvid zlib"
Comment 1 Curtis Magyar 2004-03-26 14:15:59 UTC
Created attachment 28105 [details]
MySQL++ Example

What file are you trying to compile?  I just tried one of the examples from the
tutorial here:

http://www.mysql.com/documentation/mysql++/

Which I've attached, and it compiles just fine using:

c++ -Wno-deprecated mysql++_example.cpp -o mysql++_example -L/usr/lib/mysql
-L/usr/lib/libsqlplus.so -I/usr/include/mysql -I/usr/include/mysql++ -lsqlplus
Comment 2 Voicu Liviu 2004-03-26 23:33:22 UTC
Yea, you compiled but it does not work, doesn't it?
Why? Look at your sample and to this (original one):
http://www.mysql.com/documentation/mysql++/4_Tutorial.html#SECTION03142000000000000000

The prob is here:
<code>
..
..
Query query = con.query();
query << "select * from Users";
..
..
</code>

The compilation failes on query << "select * from Users";

Your sample is not correct at all, yes it does compile but have you tried to run it? I guess not!
<your_code>
//  Query query = con.query();
con.query() << "select * from stock";
</your_code>

What is the point of writing con.query() << "select * from stock"; while you can do:
Query query = con.query();
query << "select * from stock";

Please see this thread and READ what the developers say there: (for gcc 3.3.2)
http://lists.mysql.com/plusplus/3010

Good day
Comment 3 Caleb Tennis (RETIRED) gentoo-dev 2004-09-03 11:39:53 UTC
not a gentoo issue.