1.Èí¼þ»·¾³ubuntu10.10
2. °²×°mysql -- sudo apt-get install mysqlserver
3. °²×° libmysqlclient15-dev -- sudo apt-get install libmysqlclient15-dev
£¨Èç¹ûÌáʾûÓа²×°°ü£¬¿ÉÒÔÓÃsudo apt-get install updateºÍsudo apt-get install upgrade½øÐиüкÍÉý¼¶£¬Èç¹ûûÓÐÍøÂç¿´À´ºÜÄÑѧϰubuntu£©
4 ÏÂÔØmysql++ --
http://tangentsoft.net/mysql++/releases/mysql++-3.0.9.tar.gz
5 tar -vxf mysql++-3.0.9.tar.gz
6 cd mysql++-3.0.9
7. ./configure --prefix=/usr
8. make µÚÒ»´Î¿ÉÄÜʧ°Ü£¬»áÌáʾ£º./lib/refcounted.h:258:2: ´íÎó£º ¡®size_t¡¯²»ÊÇÒ»¸öÀàÐÍÃû
./lib/refcounted.h: ÔÚ¹¹Ô캯Êý¡®mysqlpp::RefCountedPointer
½â¾ö·½·¨£º´ò¿ª./lib/refcounted.h£¬Ìí¼Ó#include
9.ÖØбàÒëmake
10. sudo make install
11. °²×°Íê±Ï¡£
12 ²âÊÔ ´úÂë
#include
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
// Get database access parameters from command line
const char* db = 0, *server = 0, *user = 0, *pass = "";
db = "school";
server = "127.0.0.1";
user = "root";
pass = "hlf";
// Connect to the sample database.
mysqlpp::Connection conn(false);
if (conn.connect(db, server, user, pass)) {
// Retrieve a subset of the sample stock table set up by resetdb
// and display it.
mysqlpp::Query query = conn.query("select * from student");
if (mysqlpp::StoreQueryResult res = query.store()) {
cout << "We have:" << endl;
mysqlpp::StoreQueryResult::const_iterator it;
for (it = res.begin(); it != res.end(); ++it) {
mysqlpp::Row row = *it;
cout << '\t' << row[0] << endl;
}
}
else {
cerr << "Failed to get item list: " << query.error() << endl;
return 1;
}
return 0;
}
else {
cerr << "DB connection failed: " << conn.error() << endl;
return 1;
}
}
13 makefile
tsql:tsql.cpp
g++ -o tsql tsql.cpp -I/usr/include/mysql -I/usr/include/mysql++ -L/usr/lib -lmysqlpp
×¢Ò⣬һ¶¨ÒªÓÐlmysqlpp£¬¸Ã¾äÊÇΪÁËʹÓÿâlibmysqlpp.a
loveline ÓÚ 2014-10-16 17:55:38·¢±í:
Thanks for share
sammas1025 ÓÚ 2014-10-05 16:17:16·¢±í:
лл·ÖÏí
mutou1991 ÓÚ 2014-09-25 17:24:38·¢±í:
Â¥Ö÷˵µÄºÃ
qxfsy ÓÚ 2014-08-09 15:21:06·¢±í:
Á˽â¹þ£¡
william2011 ÓÚ 2014-07-31 12:23:11·¢±í:
лл·ÖÏí
markvenus ÓÚ 2014-06-13 11:32:26·¢±í:
ÎÒÊÇÐÂÊÖ£¬ÎÒҪѧϰ
»ÆÉÜ¿ ÓÚ 2014-06-09 14:01:30·¢±í:
ºÃ°¡
Ö´×Å×·Çó°® ÓÚ 2014-06-07 23:39:47·¢±í:
ºÜÓÐÓÃ
Ö´×Å×·Çó°® ÓÚ 2014-06-07 23:39:28·¢±í:
²»´í
senke1 ÓÚ 2014-01-14 15:06:47·¢±í:
(e:e2sÊܽÌÁË
Jack561 ÓÚ 2014-01-13 15:20:36·¢±í:
лл·ÖÏí
idlerinwind ÓÚ 2013-09-30 11:45:53·¢±í:
ŬÁ¦Ñ§Ï°Linux
jyhll123 ÓÚ 2013-07-25 21:29:43·¢±í:
ÊܽÌ
bnmluo ÓÚ 2012-12-14 17:21:33·¢±í:
À´Ñ§Ï°Ñ§Ï°
ÓÚ 2012-12-12 10:29:59·¢±í:
ѧϰÁË
ÓÚ 2012-12-12 10:29:45·¢±í:
ѧϰÁË£¬
jdhongtao ÓÚ 2012-12-12 09:24:42·¢±í:
¶àл£¬¶¥ÆðÀ´
×í³¾·ç ÓÚ 2012-12-11 14:31:33·¢±í:
ѧϰ
gky2009514 ÓÚ 2012-12-07 12:51:26·¢±í:
ÐÂÊÖÍê³ÉÈÎÎñ£¬ÇóÏÂÊé¼®~
huangjie540 ÓÚ 2012-11-28 21:18:32·¢±í:
¶¥¶¥¶¥¶¥¶¥¶¥¶¥¶¥¶¥¶¥¶¥:0wpoi2¡£Ð»Ð»Â¥Ö÷¶î
yiiy88 ÓÚ 2012-11-28 18:17:50·¢±í:
ÐÂÈËһö ²»»á°²×°ÈκÎÈí¼þ¡£
ouyangcp ÓÚ 2012-10-08 15:04:00·¢±í:
¸Ð?ÄúµÄ½Ì?·ÖÏí!
¼ÅįÍ䵶 ÓÚ 2012-10-05 00:27:19·¢±í:
ѧϰÁË£¡
jiangjinta ÓÚ 2012-06-24 13:52:31·¢±í:
¾³½çÌ«¸ß£¬ÓеãÏñÌìÊé:0)1
jiangjinta ÓÚ 2012-06-24 13:22:05·¢±í:
¸Ð¾õÏëÔÚ¿´ÌìÊéÒ»Ñù°¡(5ty(
ŬÁ¦£¬¼ÓÓÍ
liuyanqiu0807 ÓÚ 2012-06-14 17:12:54·¢±í:
¸Ðл¥Ö÷£¡
fcyyy ÓÚ 2012-06-04 12:16:47·¢±í:
qwqqq
Lone_Arena ÓÚ 2012-05-09 11:06:47·¢±í:
:0w5ty(1
larmbr ÓÚ 2012-05-04 14:56:35·¢±í:
¸Ðл·ÖÏí£¬Ñ§Ï°ÁË£¬Ð»Ð»£¡£¡£¡
ÓÚ 2012-04-18 15:45:36·¢±í:
¶¥°¡
tan19880105 ÓÚ 2012-04-09 11:11:48·¢±í:
ÎÒÊÇÐÂÊÖ
lunan_gz ÓÚ 2012-04-09 10:48:40·¢±í:
¶¥
toby_lund ÓÚ 2012-04-02 22:18:07·¢±í:
Â¥Ö÷ÐÁ¿àÁË
fate3008 ÓÚ 2012-03-30 10:34:08·¢±í:
:0)1
zyzhang12 ÓÚ 2012-03-07 03:23:52·¢±í:
ÔÝʱδÓÃ
linuxian ÓÚ 2012-03-01 20:06:49·¢±í:
¶¥Â¥Ö÷
liulanghanzi ÓÚ 2012-02-20 16:43:06·¢±í:
Â¥Ö÷˵µÃºÜ×Ðϸ
¾ý¾ýÙâÙâ ÓÚ 2012-02-17 21:43:54·¢±í:
ÒªÊÇÓиöÊÓƵ½²½â¾ÍÍêÃÀÁË¡£
Lee2012 ÓÚ 2012-02-11 08:32:36·¢±í:
:0)1
frankhht ÓÚ 2012-01-29 20:24:46·¢±í:
¶¥