-
Make File Error
Hi everyone;
EDIT: Issue resolved, thanks Ken Fitlike
I have a program I downloaded from a net text book, and trying to build it all and run it to experiment and modify.
I read up on creating makefiles; and wrote this one for the program in question:
Code:
kalc.out: parse.o scan.o STORE.o SYMTAB.o Tree.o
g++ -o kalc.out parse.o scan.o STORE.o SYMTAB.o Tree.o
parse.o: parse.cpp parse.h scan.h store.h SYMTAB.h Tree.h
g++ -c parse.cpp
scan.o: scan.cpp scan.h symtab.h
g++ -c scan.cpp
STORE.o: STORE.CPP store.h symtab.h cmath.h iostream.h
g++ -c STORE.CPP
SYMTAB.o: SYMTAB.CPP symtab.g cassert.h cstring.h cmath.h iostream.h
g++ -c SYMTAB.CPP
Tree.o: Tree.cpp Tree.h STORE.H cmath.h iostream.h
g++ -c Tree.cpp
clean:
rm *.o kalc.out
I have been getting the same error for hours now:
Code:
$ make -f makefile.make
make: *** No rule to make target `parse.cpp', needed by `parse.o'. Stop.
Something im overlooking?
The original code im trying to build is from relisoft site
Program source code: http://www.relisoft.com/book/lang/pr...urce/calc2.zip
Ive alternatively tried loading it all up into K-Develop and using a proper development "environment", but that seems to be more problematic than just fixing my makefile. Besides, why click build on an application when you can start it from the terminal, so much more fullfilling ;)
-
In your makefile, only include the dependency headers for the project; in any event there are no such headers as cassert.h, cstring.h, nor cmath.h (there's cassert, cstring and cmath, however). Also iostream.h is non-standard.
The mixture of upper and lowercase filenames is annoying: rename the files to all lowercase or adopt a naming convention that isn't random and stick to it. I believe this was responsible for the 'no rule' make error.
Assuming you've renamed the files to lowercase and removing the redundant dependencies, your makefile becomes: Code:
kalc.out: parse.o scan.o store.o symtab.o tree.o
g++ parse.o scan.o store.o symtab.o tree.o -o kalc.out
parse.o: parse.cpp parse.h scan.h store.h symtab.h tree.h
g++ -c parse.cpp
scan.o: scan.cpp scan.h symtab.h
g++ -c scan.cpp
store.o: store.cpp store.h symtab.h
g++ -c store.cpp
symtab.o: symtab.cpp symtab.h
g++ -c symtab.cpp
tree.o: tree.cpp tree.h store.h
g++ -c tree.cpp
clean:
rm *.o kalc.out
However, there seem to be a couple of bugs in the code which shouldn't be too difficult for you to correct.
-
Thanks for making the effort, as you said I made the changes you suggested and used your file, worked like a charm. Those bugs are interesting though, but might have to do with the fact that the program was written in 1994... :o main should return int etc..
Thanks again.