makefile working correctly?

I am in need of help to see that my makefile is working correctly. I am writing a program in UNIX and using my schools server to compile and run the C++ code.

Here is my make file's contents:

==============================================
main: *.cpp *.h
g++ -o LSL main.cpp ClosedHash.cpp

clean:
rm -f *.o LSL*
==============================================

Here is the results of me running "make":

==============================================
unixserver:Lab3> make
g++ -o LSL main.cpp ClosedHash.cpp
ClosedHash.h:17: error: extra qualification âClosedHash::â on member âinsertâ
ClosedHash.h:18: error: extra qualification âClosedHash::â on member âfindâ
ClosedHash.h:19: error: extra qualification âClosedHash::â on member âremoveâ
ClosedHash.h:20: error: âHTâ has not been declared
ClosedHash.h:20: error: âposâ was not declared in this scope
ClosedHash.h:20: error: extra qualification âClosedHash::â on member âcheckHashâ
ClosedHash.h:21: error: extra qualification âClosedHash::â on member âcheckKeyâ
ClosedHash.h:22: error: extra qualification âClosedHash::â on member âprobeSeqâ
ClosedHash.h:23: error: extra qualification âClosedHash::â on member âcountâ
ClosedHash.h:24: error: extra qualification âClosedHash::â on member âalphaâ
ClosedHash.h:25: error: extra qualification âClosedHash::â on member âfullâ
ClosedHash.h:26: error: extra qualification âClosedHash::â on member âgetKeyâ
ClosedHash.h:29: error: extra qualification âClosedHash::â on member âhâ
ClosedHash.h:30: error: extra qualification âClosedHash::â on member âh2â
main.cpp: In function âint main()â:
main.cpp:172: error: no matching function for call to âClosedHash::ClosedHash(int)â
ClosedHash.h:16: note: candidates are: ClosedHash::ClosedHash()
ClosedHash.h:13: note: ClosedHash::ClosedHash(const ClosedHash&)
ClosedHash.h:17: error: extra qualification âClosedHash::â on member âinsertâ
ClosedHash.h:18: error: extra qualification âClosedHash::â on member âfindâ
ClosedHash.h:19: error: extra qualification âClosedHash::â on member âremoveâ
ClosedHash.h:20: error: âHTâ has not been declared
ClosedHash.h:20: error: âposâ was not declared in this scope
ClosedHash.h:20: error: extra qualification âClosedHash::â on member âcheckHashâ
ClosedHash.h:21: error: extra qualification âClosedHash::â on member âcheckKeyâ
ClosedHash.h:22: error: extra qualification âClosedHash::â on member âprobeSeqâ
ClosedHash.h:23: error: extra qualification âClosedHash::â on member âcountâ
ClosedHash.h:24: error: extra qualification âClosedHash::â on member âalphaâ
ClosedHash.h:25: error: extra qualification âClosedHash::â on member âfullâ
ClosedHash.h:26: error: extra qualification âClosedHash::â on member âgetKeyâ
ClosedHash.h:29: error: extra qualification âClosedHash::â on member âhâ
ClosedHash.h:30: error: extra qualification âClosedHash::â on member âh2â
ClosedHash.cpp:10: error: prototype for âClosedHash::ClosedHash(int)â does not match any in class âClosedHashâ
ClosedHash.h:13: error: candidates are: ClosedHash::ClosedHash(const ClosedHash&)
ClosedHash.h:16: error: ClosedHash::ClosedHash()
ClosedHash.cpp: In constructor âClosedHash::ClosedHash(int)â:
ClosedHash.cpp:10: error: uninitialized member âClosedHash::maxSizeâ with âconstâ type âconst intâ
ClosedHash.cpp: In destructor âvirtual ClosedHash::~ClosedHash()â:
ClosedHash.cpp:16: error: expected primary-expression before â;â token
ClosedHash.cpp: At global scope:
ClosedHash.cpp:104: error: prototype for âbool ClosedHash::insert(int, int)â does not match any in class âClosedHashâ
ClosedHash.h:17: error: candidate is: virtual bool ClosedHash::insert(int, int&)
ClosedHash.cpp: In member function âbool ClosedHash::insert(int, int)â:
ClosedHash.cpp:107: error: âHTâ was not declared in this scope
ClosedHash.cpp:109: error: no matching function for call to âClosedHash::probeSeq(int, int&)â
ClosedHash.h:22: note: candidates are: bool ClosedHash::probeSeq()
ClosedHash.cpp:112: error: âHTâ was not declared in this scope
ClosedHash.cpp: In member function âvirtual bool ClosedHash::remove(int)â:
ClosedHash.cpp:125: error: âKâ was not declared in this scope
ClosedHash.cpp:126: error: âHTâ was not declared in this scope
ClosedHash.cpp:129: error: âMâ was not declared in this scope
ClosedHash.cpp:130: error: âHTâ was not declared in this scope
ClosedHash.cpp:131: error: âeâ was not declared in this scope
ClosedHash.cpp: At global scope:
ClosedHash.cpp:137: error: âHTâ has not been declared
ClosedHash.cpp:137: error: âposâ was not declared in this scope
ClosedHash.cpp: In member function âvirtual int ClosedHash::count() constâ:
ClosedHash.cpp:156: error: argument of type âint (ClosedHash::)()constâ does not match âintâ
ClosedHash.cpp: In member function âvirtual float ClosedHash::alpha() constâ:
ClosedHash.cpp:161: error: invalid use of member (did you forget the â&â ?)
make: *** [main] Error 1
==============================================

I know it's showing a lot of errors but does it seem to be at least doing what it's suppose to be doing? Before I proceed in fixing up my program I want to make sure my makefile is fine.
1
2
3
4
5
main: *.cpp *.h
g++ -o LSL main.cpp ClosedHash.cpp

clean:
rm -f *.o LSL*


Are main.cpp and ClosedHash.cpp the only two source files?

Why don't you stick with you're original syntax:
1
2
main: *.cpp *.h
g++ -o LSL *.cpp


And why do you have an astric after LSL? are there other files beginning in LSL that are being built?

From what I see, you're clean should look like:
1
2
clean:
rm -f *.o LSL


edit:
also, are the funky letters what are actually printed as your build output, or did they appear when you pasted the output?

I think the makefile is fine, why don't you post closedHash.cpp and closedHash.h?
Last edited on
Thank you. yes they are the only two source files. I changed it to the original syntax as you suggested.

I don't know what the asterisk is for, I believe that was an instruction from the professor or another example I had found.

Yes all those funky characters are what is really printed on the screen.

Thanks for your help!
Did that tweaking of the makefile fix the problem you were having?

If not, lets take a look at your source.
Topic archived. No new replies allowed.