-   Programming (
-   -   got an error when linking mysql with c++ using cmake in ubunto 12.04 (

ninianne 06-17-2013 10:16 AM

got an error when linking mysql with c++ using cmake in ubunto 12.04
hello everyone!

now I doing my project in ubunto.

I`m developing some program using mysql, opencv.

To compile opencv in ubunto, I use cmake and it work.

but when i try to compile *.cpp file which include the code to connect to mysql server(this cpp file include <mysql/mysql.h>)

I installed libmysqlclient15-dev and mysql-server using apt-get.
And write CMakeList.txt like below

cmake_minimum)required(VERSION 2.8)
project( mysqltest c cxx)
set(LIBS ${LIBS} mysql)
add(executable(mysql_test mysql_test.cpp)
target_link_libraries(mysql_test ${LIBS})

when i put "cmake ."command, it works.
but when i put "make" command it return

/usr/bin/ld : cannot find -lmysql

this error

honestly i`m not familiar with camke compiler so i don`t know how to fix this error

if anyone know how to fix this error plz let me know(plz explain how i write CMakeList.txt file to fix this error in detail cause i`m not farmiliar with cmake........)

as i told before i install

libmysqlclient15-dev and mysql-server

so i don`t know why cmake complier return it cannot find

thanks for your help in advance

onebuck 06-17-2013 06:27 PM

Moderator Response
Moved: This thread is more suitable in <Programming> and has been moved accordingly to help your thread/question get the exposure it deserves.

All times are GMT -5. The time now is 02:28 AM.