데이터 구조를 만들었지 만 컴파일을 시도 할 때 해당 유형을 초기화하지 않도록 지정하지 않았다는 오류가 발생합니다.C++ 세트가 제대로 컴파일되지 않음
큰 숫자로는 NTL 라이브러리와 함께 작업하고 있습니다.
#include <set>
#include ...
NTL_CLIENT
using namespace std;
using namespace NTL;
const RR ZERO = to_RR(0);
const RR ONE = to_RR(1);
const RR TWO = to_RR(2);
class tenTree
{
public:
tenTree(string newName = "", int newLevel = 0);
~tenTree();
void put(string prefix, RR power);
bool get(string prefix, RR & output);
void display(int depth);
bool isKnown(RR power){return (powers.find(power) != powers.end());};
private:
tenTree* children [10];
set<int> powers;
int level;
string name;
bool child[10];
};
나는 그것을 컴파일하려고라는 오류와 함께 다시 온다 : 내가 여기에 놓친 거지 뭔가
twoPow.cpp:47: error: ISO C++ forbids declaration of \u2018set\u2019 with no type
twoPow.cpp:47: error: expected \u2018;\u2019 before \u2018<\u2019 token
twoPow.cpp: In member function \u2018bool tenTree::isKnown(NTL::RR)\u2019:
twoPow.cpp:44: error: \u2018powers\u2019 was not declared in this scope
있습니까
이 내 코드?
나는 이것이 헤더 파일이라고 추정한다. ** 헤더 파일에서'네임 스페이스 ...를 사용하지 마십시오. – chris
그래, 거기에 표준을 두드려라 :: – jdero
불행히도 우리 학교는 모든 코드를 하나의 파일에 저장하게한다. 이것은 헤더가 아닙니다. – Schuyler