Can someone help with this assignment. It involves inventory classes which inside, has a linked list of itemstacks...

Can someone help with this assignment. It involves inventory classes which inside, has a linked list of itemstacks. I keep getting "undefined reference" to Itemstack and item. There are other files that go with this, though my task was only to work on the inventory files.
#include
#include "Inventory.h"

// Allow the compiler to define the remaining
// comparison operators
using namespace std::rel_ops;

/**
*
*/
Inventory::Node::Node()
:data( Item(0, "Air"), 0 )
{
this->next = nullptr;
}

/**
*
*/
Inventory::Node::Node( ItemStack s )
:data(s)
{
this->next = nullptr;
}

/**
*
*/
Inventory::Inventory(){
this->first = nullptr;
this->last = nullptr;
this->slots = 10;
this->occupied = 0;
}

bool Inventory::addItems(ItemStack stack){

Node *new_node = nullptr;

new_node = new Node;


if( this->occupied == 0){
this->first = new_node;
this->last = new_node;
this->occupied++;
return true;
}

if (this->occupied < slots){
Node *it = new Node;
it = this->first;
bool match = false;

while (it != nullptr){
if (stack.getItem().getName() == it->data.getItem().getName()){
it->data.addItems(stack.size());
it = it->next;
}

if(match == false){
(this->last)->next = new_node;
this->last = new_node;
this->occupied++;
}
return true;
}

return false;
}

}

void Inventory::display(std::ostream& outs) const
{
Node* it = this->first;

outs

pls

no

Pls man, I need help.

Pretty pls

No, do your own homework.

Sage

You've never needed help on any assignment ever? You must be special.

>You've never needed help on any assignment ever?
Of course, but I went to my fucking TA and asked for help instead of asking Cred Forums to do my homework for me.

When did I ask for someone to do it for me? I asked for help to get rid of an error.

That is doing your homework for you bonehead
You made the error, fix it yourself

So the TA did your homework for you? ok

Why aren't you using c-hashtag instead?

It's an assignment with pre-written code and I have to finish it.

Clearly you have an undefined reference somewhere

The time you've spent lurking Cred Forums and hoping somebody would do your homework for you, you could have already found the error and already been done.

Just fix it you fucking millennial. We're not here to cater you.

>gaming laptop

Was this necessary?

No, I have the assignment open and just look over to see If I get any replies.

The question you should ask yourself is
>Is this thread necessary?

At what point did you think that was a good idea?

Bye.

They did not help me.

>There are other files that go with this
Then post them. Specifically, Itemstack.h and Item.h, if they exist. Also, Inventory.h.

Inventory.h
#ifndef INVENTORY_H_INCLUDED
#define INVENTORY_H_INCLUDED

#include

#include "ItemStack.h"

/**
* An Inventory is composed of n slots. Each slot may store only
* one type of item--specified by *slots*.
*
* Once all slots are filled, no additional Item types may be
* stored. Individual slots may contain any number of the same
* Item.
*/
class Inventory{
private:
/**
* Each Node represents on Inventory slot--i.e., space
*/
struct Node{
ItemStack data; ///< One ItemStack
Node *next; ///< Next ItemStack Node

/**
* Create an empty *Air* Node
*/
Node();

/**
* Create a Node that contains an ItemStack, *s*
*/
Node(ItemStack s);
};

Node *first; ///< First inventory slot
Node *last; ///< Last inventory slot

int slots; ///< Capacity
int occupied; ///< Number of occupied slots

public:
/**
* Default to 10 slots
*/
Inventory();

/**
* Create an inventory with n slots
*
* @pre n > 0
*/
Inventory( int n );

/**
* Add one or more items to the inventory list
*
* @return true if *stack* was added and false otherwise
*/
bool addItems( ItemStack stack );

/**
* Print a Summary of the Inventory and all Items contained within
*/
void display( std::ostream &outs ) const;
};

/**
* Print the Inventory through use of the display member function
*/
inline std::ostream& operator

#ifndef ITEM_H_INCLUDED
#define ITEM_H_INCLUDED

#include
#include

class Item{
private:
int id; ///< Unique numeric identifier--e.g., 1
std::string name; ///< Short title--e.g., HP Potion

public:
/**
* Default to id = 0 and name = Air
*/
Item();

/**
* Create an Item with an id and
* a blank name
*/
Item( int id );

/**
* Create an Item with a specified id and name
*
* @pre
* - all items that share an id are of the same type
* - id is strictly positive
*/
Item( int id, std::string name );

/**
* Retrieve numeric id
*/
int getID() const;

/**
* Update numeric id
*
* @pre i is strictly positive
*/
void setID( int i );

/**
* Retrieve name
*/
std::string getName() const;

void setName( std::string n );

bool operator==( const Item &rhs ) const;

/**
* Check ordering--based on numeric id
*/
bool operatorname;
}
inline void Item::setName( std::string n ){
this->name = n;
}

inline bool Item::operator==( const Item &rhs ) const{
return this->id == rhs.id;
}

inline bool Item::operatorid < rhs.id;
}
inline std::ostream& operator

not supposed to edit these two.
#ifndef ITEMSTACK_H_INCLUDED
#define ITEMSTACK_H_INCLUDED

#include

#include "Item.h"

/**
* A Homogeneous--i.e., uniform--stack of Items.
*/
class ItemStack{
private:
Item item; ///< Item out of which the stack is composed
int quantity; ///< Number of items in the stack

public:
/**
* Default to an empty stack composed of Air
*/
ItemStack();

/**
* Create a stack of type *item*
*
* @param item Item out of which the stack is composed
* @param s size of the stack
*
* @pre (s > 0)
*/
ItemStack( const Item &item, int s );

/**
* Retrieve the Item out of which the stack is composed
*/
Item getItem() const;

/**
* Retrieve the size of the stack
*/
int size() const;

/**
* Increase the size of the stack
*
* @param a number of items to add
* @pre a > 0
*/
void addItems( int a );

/**
* Consider two stacks to be the same if
* they contain the same type of Item
*/
bool operator==( const ItemStack &rhs ) const;

/**
* Order stacks based on Item id
*/
bool operatorquantity += a;
}

inline bool ItemStack::operator==( const ItemStack &rhs ) const{
return this->item == rhs.item;
}

inline bool ItemStack::operatoritem < rhs.item;
}

not even OP but this faggotry is really one of the most cancerous things about the internet in general, but especially Cred Forums

>hey can you help me w-
>LOL NO DUDE I'M NOT GOING TO FUCKING SPOONFEED YOU JUST FIGURE IT OUT YOURSELF

pic related is basically what you are saying, I'm sure you just fucking magically figure things out yourself with no input from anyone else. please learn the difference between "spoonfeeding" and "helping your fellow human being" you fucking retarded autists

that said, if Cred Forums was filled with "pls help me program" posts it would be shit, so I will suggest that OP 1) tries the /dpt/ thread, 2) asks on reddit (not sarcasm) somewhere that is okay with such questions

classical problem of undefined reference

Do you have any cpp files to go along those .h? Because it looks like constructors for ItemStack and Item aren't implemented anywhere. You need to compile those cpp files and link them all together.

Thank you, I know its my fault for not reviewing enough before the assignment. Though I was just asking to be pointed in the right direction.

Yes, the ADT's item and itemstack have complete implementations in their cpp's, my assignment is to complete Inventory.cpp and Inventor.h.

>not even OP

Hello OP.

>Thank you, I know its my fault for not reviewing enough before the assignment. Though I was just asking to be pointed in the right direction.
Obvious samefaggotry is blatantly obvious

ok

>he thinks editing out the (You) means anything
You're on a tech board after all. Working inspect element isn't exactly magic.