Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-17-2013, 09:16 AM   #1
LQ Newbie
Registered: Mar 2013
Posts: 6

Rep: Reputation: Disabled
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

Last edited by ninianne; 06-17-2013 at 09:19 AM.
Old 06-17-2013, 05:27 PM   #2
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,830
Blog Entries: 27

Rep: Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
cmake: Using find_package(Boost) when FindBoost.cmake is not in the default location damien_d Programming 3 10-27-2010 03:40 PM
[SOLVED] Cmake error ~sHyLoCk~ Slackware 10 12-07-2009 01:00 PM
Cmake, linking libraries yfaye Programming 1 04-08-2009 06:13 PM
installed ubunto twice by mistake now in boot up screen get 2 options for ubunto salpapa Linux - Newbie 8 06-28-2007 05:24 PM
MySQL server problem after linking (mysql.sock) ewijaya Linux - General 4 01-19-2004 09:46 AM > Forums > Non-*NIX Forums > Programming

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration