linux用eclipse编译测试mysql的代码,出现undefined reference to `mysql_init'的错误
畿米阳光 2012-05-24 01:12:54 **** Build of configuration Debug for project Exmp_mysql_1 ****
make all
Building target: Exmp_mysql_1
Invoking: GCC C++ Linker
g++ -L/usr/lib/mysql -o "Exmp_mysql_1" ./Res/Main_1.o
./Res/Main_1.o: In function `main':
/home/hcp/Workspace/Exmp_mysql_1/Debug/../Res/Main_1.cpp:18: undefined reference to `mysql_init'
/home/hcp/Workspace/Exmp_mysql_1/Debug/../Res/Main_1.cpp:19: undefined reference to `mysql_real_connect'
/home/hcp/Workspace/Exmp_mysql_1/Debug/../Res/Main_1.cpp:21: undefined reference to `mysql_query'
/home/hcp/Workspace/Exmp_mysql_1/Debug/../Res/Main_1.cpp:23: undefined reference to `mysql_store_result'
/home/hcp/Workspace/Exmp_mysql_1/Debug/../Res/Main_1.cpp:25: undefined reference to `mysql_fetch_row'
/home/hcp/Workspace/Exmp_mysql_1/Debug/../Res/Main_1.cpp:30: undefined reference to `mysql_free_result'
/home/hcp/Workspace/Exmp_mysql_1/Debug/../Res/Main_1.cpp:31: undefined reference to `mysql_close'
collect2: ld 返回 1
make: *** [Exmp_mysql_1] 错误 1
**** Build Finished ****
///////////////////////////////////////////////////////////////////////////////////////////////////////////
在/usr/include/mysql 和 /usr/lib/mysql目录下都 有头文件和库文件
查资料是连接错误,但是不知道怎么解决,请教大家。
另外,我用 $ g++ Main_1.cpp -o Main_1 -lmysqlclient 编译
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld 返回 1
有哪位大侠,知道怎么解决,请赐教。谢谢!