0

Picture of Terminal showing error. This picture shows the terminal that describes what error I am getting whenever I run the make command. Down below is also the actual makefile that I am using and I am very confused about what the problem even is? I am not sure if it has to do with the driver.cpp or with the makefile but pls help!!

this is arrayQueue.h file

hw4: driver.o customer.o event.o arrayQueue.o
    g++ -o hw4.exe driver.o customer.o event.o arrayQueue.o

driver.o: driver.cpp event.h customer.h arrayQueue.h
    g++ -c driver.cpp

arrayQueue.o: arrayQueue.cpp arrayQueue.h queueInterface.h
    g++ -c arrayQueue.cpp

customer.o: customer.cpp customer.h
    g++ -c customer.cpp  

event.o: event.cpp event.h
    g++ -c event.cpp 

clean:
    rm *.o
Dylan
  • 1
  • 1
  • 1
    Please use proper formatting to make your error messages readable, and include all the messages and the output that make generates, cut and pasted to avoid typos. The message `error: ld returned 1` just tells you the command failed, it doesn't tell you WHY it failed. The reasons (the error messages) will be before this. Usually you want to pay attention to the FIRST errors, not the last errors. The text in your final paragraph `driver.o:driver.cpp: undefined reference` doesn't make any sense to me so please include the full set of messages, verbatim with formatting. – MadScientist Mar 07 '22 at 01:49
  • I updated my question and added a picture of the terminal. – Dylan Mar 07 '22 at 01:54
  • You haven’t invoked a linker – Daniel A. White Mar 07 '22 at 01:55
  • how do I do that? – Dylan Mar 07 '22 at 02:04
  • The makefile looks all right. How big is `arrayQueue.h`? Could you add it to the question? – Beta Mar 07 '22 at 02:18
  • Oh, wait... Ordinary classes can have their members *declared* in the header (`foo.h`), and *defined* in the source (`foo.cc`). But you know that member functions of *template* classes must be defined in the header, right? – Beta Mar 07 '22 at 02:22
  • I added the picture of arrayQueue.h – Dylan Mar 07 '22 at 02:24
  • 1
    That explains it. You must move the definitions of the member functions of `ArrayQueue` into `arrayQueue.h`. See ["Why can templates only be implemented in the header file?"](https://stackoverflow.com/questions/495021/why-can-templates-only-be-implemented-in-the-header-file). And in future posts, don't post imags of code, or links, or links to images; post the actual text in the body of the question. – Beta Mar 07 '22 at 02:33

0 Answers0