0

Hello guys.. I have this makefile:

MyMatrix‬‬: MyMatrix.o
	gcc MyMatrix.o -o MyMatrix

MyMatrix.o: MyMatrix.c
	gcc -c MyMatrix.c

MyStringMain: MyString.o MyStringMain.o
	gcc  MyString.o MyStringMain.o -o MyString -o MyStringRun

MyStringMain.o: MyStringMain.c MyString.c MyString.h
	gcc -c MyStringMain.c 

MyString.o: MyString.c MyString.h
	gcc -c MyString.c


.PHONY:clean
clean: 
	rm -f *.o test.out

For some reason, only the MyMatrix file is created.. Any ideas why?

*p.s: all the files are good and have no errors.

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by MarounMaroun
Featured Replies
  • Try this one [code] MyMatrix‬‬: MyMatrix.o MyStringMain gcc MyMatrix.o -o MyMatrix MyMatrix.o: MyMatrix.c gcc -c MyMatrix.c MyStringMain: MyString.o MyStringMain.o gcc MyString.o MyStringMain.o -o MyString -o MyStringRun MyStringMain.o: MyStringMain.c MyString.c MyString.h gcc -c MyStringMain.c MyString.o: MyString.c MyString.h gcc -c MyString.c .PHONY:clean clean: rm -f *.o test.out [/code] Read More

1

Try this one

MyMatrix‬‬: MyMatrix.o MyStringMain
	gcc MyMatrix.o -o MyMatrix

MyMatrix.o: MyMatrix.c
	gcc -c MyMatrix.c

MyStringMain: MyString.o MyStringMain.o
	gcc  MyString.o MyStringMain.o -o MyString -o MyStringRun

MyStringMain.o: MyStringMain.c MyString.c MyString.h
	gcc -c MyStringMain.c 

MyString.o: MyString.c MyString.h
	gcc -c MyString.c


.PHONY:clean
clean: 
	rm -f *.o test.out
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.