The template class header file uses a .tpp file for definitions of the functions. And yes the TeEdge is a typedef for a template specialization.
I tried something else now though. I opened the previos project which Im uses that same library but functions fine, and I created a new class (added new class to project) called classadded2 Here's the code:
Header file:
Code:
#include <iostream>
#include "InputReader.h"
#include "GRAPH/Graph.h"
#include "DemandNodeType.h"
#include "DemandEdgeType.h"
class classadded2 {
public:
classadded2();
classadded2(int x);
~classadded2();
Graph<DemandNode,DemandEdge>& _demandGraph;
void returningDemandGraph(InputReader& _ir);
};
Cpp file:
Code:
#include "classadded2.h"
classadded2::classadded2(){
}
classadded2::classadded2(int x){
int n = x;
}
classadded2::~classadded2(){
}
filebuf buf;
ostream outf(&buf);
InputReader& ir("cost239_conf.gml","pp",outf,&buf,1);
void classadded2::returningDemandGraph(InputReader& _ir){
std::cout<<"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"<<endl;
_demandGraph = _ir.GetDemandGraph();
std::cout<<"IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"<<endl;
}
(DemandEdge and DemandNode are typedefs of the template classes)
Now I'm simply trying to call the Function rturningDemandGraph from a different class. This is how I initialize the objects.. When I initialized this exact same way in another project, it ran perfectly fine. and here everything compiles fine untill I call the function returningDemandGraph.
In the header file of the class that will call the function I have:
#include "classadded2.h"
classadded2 ca2;
and in the .cpp file:
ca2.returningDemandGraph(ir);
also tried in the .cpp:
classadded2 ca2();.
classadded2 ca2 = classadded2(); (after removing the declaration from the header of course.)
and same as before... I get this:
Simulator.o(.text+0x54): In function `Simulator::~Simulator [not-in-charge]()':
/usr/include/g++/bits/stl_tree.h:166: undefined reference to `classadded2::~classadded2 [in-charge]()'
Simulator.o(.text+0x74): In function `Simulator::~Simulator [in-charge]()':
/usr/include/g++/bits/basic_string.h:728: undefined reference to `classadded2::~classadded2 [in-charge]()'
Simulator.o(.text+0x95): In function `Simulator::~Simulator [in-charge deleting]()':
/usr/include/g++/i586-suse-linux/bits/atomicity.h:38: undefined reference to `classadded2::~classadded2 [in-charge]()'
Simulator.o(.text+0x273): In function `Simulator::Runs(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int)':
/usr/include/g++/bits/basic_string.h:249: undefined reference to `classadded2::returningDemandGraph(InputReader&)'
Simulator.o(.text+0x14): In function `Simulator::Simulator[not-in-charge]()':
/usr/include/g++/bits/stl_tree.h:1036: undefined reference to `classadded2::classadded2[in-charge]()'
Simulator.o(.text+0x34): In function `Simulator::Simulator[in-charge]()':
/usr/include/g++/bits/basic_string.h:249: undefined reference to `classadded2::classadded2[in-charge]()'
collect2: ld returned 1 exit status
make: *** [examp] Error 1
I appreciate all the help, I know this is getting irritating...