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??? |
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 |
Great job mark thread as solved for others to benefit
|
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. |
All times are GMT -5. The time now is 07:34 PM. |