This is a similar question to others, BUT I have checked what this is being flagged as a duplicate as, and the general responses aren't helping me because I either do not understand them or they are irrelevant to my issue. I need help and/or a solution specifically to this problem. Please and thank you. I am building a "programming language" (but it isn't really, just don't know how to describe it), and in my ContainerList class I keep getting this error saying that there is no matching call for function. Why am I getting this error?
I've tried manipulating where and when the constructor is used or defined or if it even exists. But there seems to be no luck. I looked into the MemoryContainer class and it doesn't seem like there is anything to cause the error.
Here is my code for the ContainerList class:
#include "MemoryContainer.cpp"
struct ContainerListItem{
int index = 0;
MemoryContainer item;
ContainerListItem* nextItem;
ContainerListItem(byte none) {}
};
class ContainerList{
public:
int getSize() {return size;}
void addContainer(MemoryContainer item){
ContainerListItem indexItem = ContainerListItem(1);
indexItem.item = item;
indexItem.index = size - 1;
indexItem.nextItem = &firstItem;
firstItem = indexItem;
size++;
}
MemoryContainer getContainer(int index){
ContainerListItem currentItem = ContainerListItem(1);
currentItem = firstItem;
while(currentItem.index != index)
currentItem = *currentItem.nextItem;
return currentItem.item;
}
private:
int size = 1;
ContainerListItem firstItem = ContainerListItem(1);
};
full error for the defined constructor:
In file included from Main.cpp:1:
ContainerList.cpp: In constructor ‘ContainerListItem::ContainerListItem(uint8_t)’:
ContainerList.cpp:7:34: error: no matching function for call to ‘MemoryContainer::MemoryContainer()’
ContainerListItem(byte none) {}
^
In file included from ContainerList.cpp:1,
from Main.cpp:1:
MemoryContainer.cpp:24:5: note: candidate: ‘MemoryContainer::MemoryContainer(uint64_t, std::__cxx11::string)’
MemoryContainer(lint ContainerSize, string name){
^~~~~~~~~~~~~~~
MemoryContainer.cpp:24:5: note: candidate expects 2 arguments, 0 provided
MemoryContainer.cpp:17:7: note: candidate: ‘MemoryContainer::MemoryContainer(const MemoryContainer&)’
class MemoryContainer{
^~~~~~~~~~~~~~~
MemoryContainer.cpp:17:7: note: candidate expects 1 argument, 0 provided
MemoryContainer.cpp:17:7: note: candidate: ‘MemoryContainer::MemoryContainer(MemoryContainer&&)’
MemoryContainer.cpp:17:7: note: candidate expects 1 argument, 0 provided