Bug #2981 Link error with mysqlclient using 4.0.18 and MySQL++ 1.7.9-4.rh
Submitted: 26 Feb 2004 14:17 Modified: 27 Feb 2004 13:55
Reporter: K Mason Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.0.18 OS:Linux (Linux (Redhat 9 Pro))
Assigned to: Dean Ellis CPU Architecture:Any

[26 Feb 2004 14:17] K Mason
Description:
According to what I've seen, MySQL++ on Redhat 9 requires 4.0.12 (or above - I assume).  See below for what I have installed.  Are other link libraries required?  I cannot find sample Makefiles for MySQL++.

# uname -a
Linux www2 2.4.20-6 #1 Thu Feb 27 10:06:59 EST 2003 i686 i686 i386 GNU/Linux

# make
g++  -felide-constructors   -Wno-deprecated -I/usr/include/sqlplus -I/usr/includ
e/mysql  -lmysqlclient -lz -o CartService CartService.cpp
/tmp/cclU6xcN.o(.text+0x626): In function `main':
: undefined reference to `MysqlConnection::MysqlConnection[in-charge](char const
*, char const*, char const*, char const*, bool)'
collect2: ld returned 1 exit status
make: *** [CartService] Error 1

# rpm -qa | grep "mysql\|MySQL"
MySQL-shared-compat-4.0.18-0
mod_auth_mysql-1.11-12
perl-DBD-MySQL-2.1021-3
MySQL-devel-4.0.18-0
mysql++-1.7.9-4.rh9
php-mysql-4.2.2-17
MySQL-server-4.0.18-0
MySQL-client-4.0.18-0

How to repeat:
//  Try to compile and link this code using RPM install listed above on Redhat 9

#include <unistd.h>
#include <stdio.h>
#include <string.h>

#include <string>
#include <map>
#include <fstream>
#include <iostream> 
#include <iomanip> 
#include <sqlplus.hh>
using namespace std;

int main( int argc, char **argv )
{
  Connection con("somedb");
}
[27 Feb 2004 13:55] Dean Ellis
You are not linking to libsqlplus (mysql++).