Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
mysql:it 's a db not a dbms how it 's possible?!
Does the binary log enabling affect the MySQL performances?
Strange behavior, Table Level Permission
FULLTEXT query format question
Preventing Duplicate Entries
Comparing and writing out BLOBS
Executing MySQL Commands From Within C Program
Can 't access mysql after kernel upgrade
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Downgrade Mysql from 4 to 3 23
MySQL Cluster Software
mysql test 4 1 fails with the gis test
ERROR 2002: Can 't connect to local MySQL server through socket
Getting Identity after INSERT
Update one field with more fields from another table
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
mysql have same function mthod as Oracle decode()
 
undefined reference to `connect_to_db`

undefined reference to `connect_to_db`

2006-11-21       - By Martin Ivanov

 Back
Reply:     1     2  

Hello! I am running Slackware Linux 11.0 with kernel 2.6.18, mysql-5 (See http://sql-5.ora-code.com).0.24a-i486
-1 and mysql++-2.1.1-i386-1. My mysql user is mysql. I have problems with
compilation of the first example from the user manual. I have renamed it to
"mysql++examples.cpp". The program is as follows:

#include "util.h"
#include <mysql++.h>
#include <iostream>
#include <iomanip>
using namespace std;

int main(int argc,char *argv[])
{
mysqlpp::Connection con(false);
if(!connect_to_db(argc,argv,con)) return 1;

mysqlpp::Query query = con.query();
query << "select item from stock";
mysqlpp::Result res = query.store();

cout << "We have:" << endl;
if(res) {
char buf[100];
mysqlpp::Row row;
mysqlpp::Row::size_type i;
for(i=0;row=res.at(i);++i) {
cout << '\t' <<utf8trans(row.at(0),buf,sizeof(buf)) << endl;
}
}
else {
cerr << "Failed to get item list: " << query.error() << endl;
return 1;
}

return 0;
}

I try to compile it with the following command:

mysql@(protected):~$ g++ -I/usr/include/mysql -I/home/marto/Linux_programs/mysqlc++
/mysql++-2.1.1/examples/ -I/usr/include/mysql++ -lmysqlclient -lmysqlpp -o exe
_mysql++examples mysql++examples.cpp

but I get the following error:

/tmp/ccm1jMwt.o(.text+0x148): In function `main':
: undefined reference to `connect_to_db(int, char**, mysqlpp::Connection&, char
const*)'
/tmp/ccm1jMwt.o(.text+0x2f0): In function `main':
: undefined reference to `utf8trans(char const*, char*, int)'
collect2: ld returned 1 exit status

Please help me. Any suggestions will be appreciated.

Regards,
Martin

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Survivor BG. ??????????? ?????????? ?? www.survivor.btv.bg

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=mysql@(protected)