Help answer threads with 0 replies.
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 04-12-2007, 05:53 PM   #1
LQ Newbie
Registered: Dec 2006
Posts: 29

Rep: Reputation: 15
gcc compile error (-lmysql: command not found)

hello everyone,

i have a program that uses pcap and mysql libraries.

i have a makefile;

	LIBS=-L/usr/include/mysql -lmysqlclient -lpcap
	gcc -Wall -pedantic $(LIBS) -o main main.c
when i run make command it gives the error

LIBS=-L/usr/include/mysql -lmysqlclient -lpcap
/bin/sh: -lmysqlclient: command not found
make: *** [all] Error 127
but when i was using only mysql library ;

gcc -o main  -L/usr/include/mysql -lmysqlclient main.c
was working.

now how can i compile the source code that uses two libraries?
Old 04-12-2007, 06:40 PM   #2
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
In Makefiles, inside rules tab-indented sections are interpreted like shell commands, and this can include a var=value prefix to a command.

Instead, move the assignment to the LIBS variable out of the rule:

LIBS = -L/usr/include/mysql -lmysqlclient -lpcap

	gcc -Wall -pedantic $(LIBS) -o main main.c
Old 04-13-2007, 10:00 AM   #3
LQ Newbie
Registered: Dec 2006
Posts: 29

Original Poster
Rep: Reputation: 15
thanks for your answer.


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
gcc not found error when trying to compile a new kernel sofocle Linux - Software 2 12-31-2006 01:16 PM
gcc: command not found tds2000_us Fedora 1 08-03-2006 09:02 AM
gcc: Command not found Lastomega Linux - Newbie 12 03-31-2006 11:28 PM
makefile gcc command cannot be found Mogul83 Programming 7 05-31-2005 04:11 AM
Error Message gcc: Command not found Schmurff Fedora 2 09-27-2004 01:23 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:20 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