I'm attempting to create a node class for use in a later to be coded linked list class, but while testing the node I've been encountering an error, "undefined reference to 'node::node()'". I've found similar errors on other questions asked but none of them have given an answer that applies here. This is my main.cpp file,
#include "node.h"
using namespace std;
int main()
{
node obj;
int j = 1000;
obj.setAnd(j);
cout << obj.getAnd();
return 0;
}
My node.h file,
#ifndef NODE_H
#define NODE_H
class node
{
private:
int operand;
char oper;
node *next;
public:
node();
node(int);
node(char);
int getAnd(){return operand;}
int getOr(){return oper;}
node* getNext(){return next;}
void setAnd(int a){operand=a;}
void setOr(char o){oper=o;}
void setNext(node* newNext){next=newNext;}
};
#endif // NODE_H
And my node.cpp file.
#include "node.h"
node::node()
{
//ctor
/*int operand= 0;
char oper= 'a';
next = NULL;*/
}
node::node(int an)
{
operand=an;
}
node::node(char or)
{
oper=or;
}
node::~node()
{
//dtor
}
I can't seem to see anything wrong here, so I'm wondering if it's how my compiler is running.
Edit: I created a new project and pasted all the files into the new project and that fixed it.