Make File Error

This is a discussion on Make File Error within the C++ Programming forums, part of the General Programming Boards category; Hi everyone; EDIT: Issue resolved, thanks Ken Fitlike I have a program I downloaded from a net text book, and ...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    19

    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
    Last edited by Roule; 10-13-2004 at 08:02 AM.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    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.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    19
    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... main should return int etc..

    Thanks again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 03:09 AM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  3. Why wont my function exit correctly?
    By LightsOut06 in forum C Programming
    Replies: 2
    Last Post: 10-09-2005, 09:23 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21