"recipe for target failed" Problem

Hey there everyone!

What i'm trying to do:
so my mission is to write a program that will manage an academic institution.
I need to create four classes (Student, Course, Department, Academic Institute).

The hard part (I think) is creating a list of Courses for each student (and later create a list of Students for each Course...)
So i created a template class Node:

This is its .cpp code:
#include "Node.h"

template<class Type>
Node<Type>::Node() {
// TODO Auto-generated constructor stub
cout<<"NEW NODE!"<<endl;
nodePointer = NULL;
}

template<class Type>
Node<Type>::Node(Type data){
cout<<"NEW NODE!1"<<endl;
this->nodeData = data;
this->nodePointer = NULL;
}

template<class Type>
Node<Type>::Node(Type value, Node<Type> * nextNode){
this->nodeData = value;
this->nodePointer = nextNode;
}

template<class Type>
void Node<Type>::operator =(const Node<Type> &other){
if(this != &other){
if(other.nodeData != nodeData){
other.nodeData = nodeData;
other.nodePointer = nodePointer;
}
}
}

template<class Type>
Type Node<Type>::getNodeData(){
return nodeData;
}

template<class Type>
Node<Type> * Node<Type>::getNodePointer(){
return nodePointer;
}

template<class Type>
void Node<Type>::setNodeData(Type data){
this->nodeData = data;
}

template<class Type>
void Node<Type>::setNodePointer(Node<Type> * pointer){
this->nodePointer = pointer;
}

template<class Type>
Node<Type>::~Node() {
// TODO Auto-generated destructor stub
}


AND when I try to define this GET function:

Node<Course> Student::getList() const{
return *newList;
}

Comes the problem which I mentioned in the title

It writes:
"make:*** [EX3] Error 1".
"recipe for target 'EX3' failed" with a reference to line 45 in "makefile"

I have search the internet for answers with no luck so far,
Hope you could help me.
Last edited on
Hi,

Not sure if this is the problem but, all template code should be in the header file.

https://isocpp.org/wiki/faq/templates#templates-defn-vs-decl
Ok good to know! i'll change that and i hope this would be the solution.
Registered users can post here. Sign in or register to post.