Author: Stan Eisenstat
Subject: Re: [Cs223] How to properly #include extra header files
Date: Friday, 03 Apr 2020, 23:15:17
> Message Posted By: Unknown ... > I currently have Aspnes' stack function prototypes in a file called > stack.h and the function code in stack.c. I have done #include "stack.h" > at the top of both stack.c and Deque.c, but when I run make, I get an > error saying there is an "undefined reference to stackPop, stackPush, etc" > (Aspnes' stack functions). That message signifies that in your Makefile the command to make Qsort does not include stack.c or stack.o as one of the source files. ===== > You said in a related post that we should include a local copy of stack.h, > but I was not sure what you meant by that. Does that mean to just #include > "stack.h" as I did? In that case the student seemed to have put the code from Aspnes into a .h file and #include-d it in Deque.c, which avoids changing the Makefile. ===== > Do we need to add a line to our makefile, like stack.o: stack.h? That is the correct approach. --Stan-PREV INDEX NEXT