我写了一个最简单的连接\关闭MYSQL的程序,可编译通过了,连接却怎么也不行,这是怎么回事啊.
cd /usr/exercise/
g++ -o test test.o -L/usr/local/mysql/lib -lmysqlclient
/usr/local/mysql/lib/libmysqlclient.a(my_compress.o): In function `my_compress_alloc':
my_compress.o(.text+0xb4): undefined reference to `compress'
/usr/local/mysql/lib/libmysqlclient.a(my_compress.o): In function `my_uncompress':
my_compress.o(.text+0x12a): undefined reference to `uncompress'
collect2: ld returned 1 exit status
Compilation exited abnormally with code 1 at Fri Jul 16 20:53:33
太好了,感谢默难,问题解决了.能麻烦说明怎么回事吗.
另外在连接时是否需要先启动才行啊,而不是程序触发启动MYSQL呢,因为我刚开始没启动MYSQL时,不能连接上
mysql_real_connect() failed:
Error 2002 (Can't connect to local MySQL server through socket '/tmp/mysql.sock'