이 cpp 파일이 있습니다.C++ 'ClassName Not Declared'오류
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
이 헤더 파일
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
그리고 DisjointSets 더 선언하고있다 "고 말을하지 않는 오류가 계속 "
~
~
컴파일 명령은 어떻게 생겼습니까? – James
또한 오타가있는 경우 모르겠지만 #ifndef와 #define에 사용되는 토큰은 동일해야합니다. – Stephen
또 다른 것은 "using namespace ...;" 헤더 파일에. – Stephen