LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 04-12-2007, 04:53 PM   #1
xface66
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;

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

Code:
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 ;

Code:
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, 05:40 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

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

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

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

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


Reply


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 12:16 PM
gcc: command not found tds2000_us Fedora 1 08-03-2006 08:02 AM
gcc: Command not found Lastomega Linux - Newbie 12 03-31-2006 10:28 PM
makefile gcc command cannot be found Mogul83 Programming 7 05-31-2005 03:11 AM
Error Message gcc: Command not found Schmurff Fedora 2 09-27-2004 12:23 PM


All times are GMT -5. The time now is 01:42 AM.

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