热门关键字:  ubuntu  分区  函数  Fedora  linux系统进程

Linux环境下MySQL 编译问题解决

来源: 作者: 时间:2008-06-17 Tag: 点击:
mysql -2.1.1.tar.gz

安装步骤:
1、make clean
2、./configure
3、su
4、make
5、make install
6、ln -s /usr/local/lib/libmysqlpp.so /usr/lib/libmysqlpp.so

第6步很关键,建立符号连接,否则运行程序将出现如下错误:

./test: error while loading shared libraries: libmysqlpp.so: cannot open shared object file: No such file or directory

此处步骤占去了整个过程99%的时间。

Makefile:这个文件临时写的,可以简化,请高手不要见笑。

test:test.o
g test.o -o test -L/usr/lib/mysql -lmysqlclient -lmysqlpp
test.o:test.c
g -c test.c -I/usr/include/mysql -I/usr/local/include/mysql
.PHONY:clean
clean:
-rm -f *.o test

测试代码:
test.c
#include
#include

using namespace std;

int main()
{
cout<<"hello"< getchar();
return 0;
}

如果还是不行,查看/etc/ld.so.conf文件,看是否包含了/usr/local/lib(mysql 的lib文件夹),如果没有,就加上,然后执行ldconfig

或者将/usr/local/lib 加入LD_LIBARAY_PATH , 可以echo $LD_LIBRARY_PATH看一看,source下。

最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册