Question: I need help with fixing the errors on my program in c++. Here are the files, main:#include #include LinkedList.hpp int main() { // Create a

I need help with fixing the errors on my program in c++. Here are the files,

main:#include #include "LinkedList.hpp" int main() { // Create a LinkedList object LinkedList list; // Fill the list from a file list.fillListFromFile(); // Search for a value int searchValue = 5; bool found = list.searchVal(searchValue); if (found) { std::cout << searchValue << " found in the list." << std::endl; } else { std::cout << searchValue << " not found in the list." << std::endl; } // Count frequency of an item int frequencyValue = 291; int frequency = list.countFrequencyOf(frequencyValue); std::cout << frequencyValue << " occurs " << frequency << " times in the list." << std::endl; // Get the size of the list int size = list.size(); std::cout << "Size of the list: " << size << std::endl; // Display elements from the front to the nth element int n = 5; list.displayFromFrontToN(n); // Display elements from the nth element to the end list.displayFromNToEnd(n); // Insert an item in order int insertValue = 100; list.insertInOrder(insertValue); // Display the list in rows list.displayInRows(); return 0; } node.cpp: #include "Node.hpp" template Node::Node() { next = nullptr; } template Node::Node(T t) { next = nullptr; item = t; } template T Node::getItem() const { return item; } template void Node::setItem(T t) { item = t; } template void Node::setNext(Node* nxt) { next = nxt; } template Node* Node::getNext() const { return next; } node.hpp:#pragma once template class Node { private: T item; Node* next; public: Node(); Node(T t); T getItem() const; void setItem(T t); void setNext(Node* nxt); Node* getNext() const; }; #include "Node.cpp" // Include the implementation linked list.cpp:#include "LinkedList.hpp" #include "Node.hpp" template LinkedList::LinkedList() { head = nullptr; itemCount = 0; } template LinkedList::~LinkedList() { // Implement the destructor if needed // For example, you might need to delete all nodes } template bool LinkedList::searchVal(T item) const { // Implement searchVal return false; // Placeholder return, replace with actual implementation } template int LinkedList::countFrequencyOf(T item) const { // Implement countFrequencyOf return 0; // Placeholder return, replace with actual implementation } template int LinkedList::size() const { return itemCount; } template void LinkedList::displayFromFrontToN(int n) const { // Implement displayFromFrontToN } template void LinkedList::displayFromNToEnd(int n) const { // Implement displayFromNToEnd } template void LinkedList::insertInOrder(T item) { // Implement insertInOrder } template void LinkedList::fillListFromFile() { // Implement fillListFromFile } template void LinkedList::displayInRows() const { // Implement displayInRows } linkedList.hpp: #pragma once #include "Node.hpp" template class LinkedList { private: Node* head; int itemCount; public: LinkedList(); ~LinkedList(); bool searchVal(T item) const; int countFrequencyOf(T item) const; int size() const; void displayFromFrontToN(int n) const; void displayFromNToEnd(int n) const; void insertInOrder(T item); void fillListFromFile(); void displayInRows() const; }; and then a

linklissteddata1.txt:717 579 291 640 610 19 532 476 864 696 824 621 67 154 575 411 646 589 572 304 322 710 576 291 49 753 317 674 201 238 506 375 887

I keep getting these errors: Undefined symbol:
LinkedList: insertInOrderi nt)
( Undefined symbol:
LinkedList::fillListFromFile
Undefined symbol:
LinkedList::LinkedList()
× Undefined svmbol:
LinkedList::~LinkedList()
( Undefined symbol:
LinkedList::displayInRows ) const
@ Undefined svmbol:
LinkedList::countFrequenc yOf(int) const

* Undefined symbol:
LinkedList::displayFromNT oEnd(int) const

(* Undefined symbol:

LinkedList::displavFromFr ontToN(int) const

& Undefined svmbol:

LinkedList.:size() const

Undefined symbol:

LinkedList: searchVal(int)

const

@ Linker command failed with exit

code 1 (use -v to see invocation)

v c* Node

  • & Redefinition of 'Node'
  • & Redefinition of 'Node'
  • & Redefinition of 'getitem'
  • & Redefinition of 'setitem'
  • a Redefinition of 'setNext'
  • @ Redefinition of 'getNext'

can you help me fix it so the build is succesful?

Step by Step Solution

3.34 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

It looks like youre encountering a variety of errors related to undefined symbols and redefinitions ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Operating System Questions!