C++ 'ClassName Not Declared' Error
- by Arjun Nayini
I have this cpp file.
dsets.cpp:
#ifndef DSETS_CPP
#define DSET_CPP
//Adds elements to the DisjointSet data structure. This function adds
//x unconnected roots to the end of the array.
void DisjointSets::addelements(int x){
}
//Given an int this function finds the root associated with that node.
int DisjointSets::find(int x){
return 0;
}
//This function reorders the uptree in order to represent the union of two
//subtrees
void DisjointSets::setunion(int x, int y){
}
#endif
and this header file
dsets.h:
#ifndef DSETS_H
#define DSET_H
#include <iostream>
#include <vector>
using namespace std;
class DisjointSets
{
public:
void addelements(int x);
int find(int x);
void setunion(int x, int y);
private:
vector<int> x;
};
#include "dsets.cpp"
#endif
And I keep getting an error that is saying that "DisjointSets has no been declared"
~
~