LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-29-2012, 11:28 PM   #1
renjith007
LQ Newbie
 
Registered: Jan 2012
Posts: 2

Rep: Reputation: Disabled
make: *** No rule to make target `main.c', needed by `main.o'. Stop.


I had a doubt regarding Makefile..i have created a Makefile.But i get error like make: *** No rule to make target `main.c', needed by `main.o'. Stop.

My source files main.c,hello.c ,hello1.c resides in src directory and include files function.h function1.h resides in inc directory.These two directories src and inc are in work directory.Make file resides in work directory
---------------------------------------------------
CC=gcc
vpath src
vpath inc

CPPFLAGS=-I inc

main : main.o hello.o hello1.o
$(CC) -o $(CPPFLAGS) $<
..c.o:
main.o : main.c function.h function1.h
$(CC) -c $(CPPFLAGS) $<
hello.o : hello.c function.h
$(CC) -c $(CPPFLAGS) $<
hello1.o : hello1.c function1.h
$(CC) -c $(CPPFLAGS) $<


.PHONY clean:
rm -rf *.o
---------------------------------------------------
can nyone fix this problem plz???
 
Old 01-30-2012, 03:41 AM   #2
renjith007
LQ Newbie
 
Registered: Jan 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Smile Got it!!!

CC=gcc
vpath src
vpath inc

CPPFLAGS=-I inc

main : main.o hello.o hello1.o
$(CC) -o $(CPPFLAGS) $<

main.o : main.c function.h function1.h
$(CC) -c $(CPPFLAGS) $< $(CPPFLAGS)
hello.o : hello.c function.h
$(CC) -c $(CPPFLAGS) $< $(CPPFLAGS)
hello1.o : hello1.c function1.h
$(CC) -c $(CPPFLAGS) $< $(CPPFLAGS)


.PHONY clean:
rm -rf *.o

changes made in Bold

Last edited by renjith007; 01-30-2012 at 03:42 AM.
 
Old 01-30-2012, 04:12 AM   #3
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Great job mark thread as solved for others to benefit
 
Old 02-07-2012, 02:08 AM   #4
rahel
LQ Newbie
 
Registered: Feb 2012
Posts: 1

Rep: Reputation: Disabled
I have Almost sme problem, plz I need your help

I recently installed AMD APP SDK on linux(ubuntu), so when I tried to compile a sample by the command (make ) as shown in int doc, I got this information:

mkdir -p depends/x86_64
perl ../../../../../make/fastdep.pl -I. -I../../../../../include -I../../../../../samples/opencl/SDKUtil/include --obj-suffix='.o' --obj-prefix='build/debug/x86_64//' BinarySearch.cpp > depends/x86_64/BinarySearch.depend
mkdir -p build/debug/x86_64/
Building build/debug/x86_64//BinarySearch.o
g++ -Wpointer-arith -Wfloat-equal -g3 -ffor-scope -I ../../../../../samples/opencl/SDKUtil/include -I "/include" -I ../../../../../include -o build/debug/x86_64//BinarySearch.o -c BinarySearch.cpp
make: *** No rule to make target `../../../../../samples/opencl/SDKUtil/build/debug/x86_64//libSDKUtil.a', needed by `build/debug/x86_64/BinarySearch'. Stop.
 
  


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
Error in Makefile:No rule to make target `g++',needed by... stop karthik.c Programming 5 03-09-2009 01:55 AM
Help needed for make file problem : make: *** No rule to make target `flash', needed rameshsatyavaram Linux - Newbie 3 09-11-2008 03:13 AM
No rule to make target `init/main.o' Nunana Fedora 4 03-18-2007 07:04 AM
Belkin Wirless G RTL8185L make[1]: *** No rule to make target `Makefile'. Stop. SilverRock Linux - Wireless Networking 2 02-11-2007 08:25 AM
No rule to make target `/mkspecs/default/qmake.conf', needed by `Makefile'. Stop Julianus Linux - General 0 12-21-2003 08:17 AM


All times are GMT -5. The time now is 09:06 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration