2012-02-22 2 views
0

내 main.cpp에 SimpleGraph.h 파일이 포함 된 일부 코드가 C++로 있습니다. 내가 컴파일하려고하면 :C++ 컴파일러 오류 : 형식이없는 'set'선언을 ISO C++에서 금지합니다.

In file included from main.cpp:9: 
SimpleGraph.h:201: error: ISO C++ forbids declaration of ‘set’ with no type 
SimpleGraph.h:201: error: invalid use of ‘::’ 
SimpleGraph.h:201: error: expected ‘;’ before ‘<’ token 

그런 다음 다른 줄에 유사한 오류가 발생합니다.

std::set<int> getConvexHullPoints() const {return convexHullPoints;} 

비슷한 오류 I에 유래에 발견은 일반적으로 누락에서 줄기 것 같다 '표준 : :'하지만, 여기가 존재 : 여기에 지정된 라인 (201)이다. 내가 아는 다른 사람들은 같은 컴파일러로 SimpleGraph.h를 사용했지만 아무런 문제가 없었다. 그래서 내가 main.cpp에서 그것을 부르는 방식 일 수 있습니까? 여기에 내가 사용 :

#include <iostream> 
#include <fstream> 
#include <stdio.h> 
#include <stdlib.h> 
#include <time.h> 
#include <math.h> 
#include <vector> 
#include "SimpleGraph.h" 

using namespace std; 

...then the main body of the program 

어떤 도움을 주시면 감사하겠습니다.

편집이 : 난 그냥 hmjd 및 KennyTM에 의해 지적, MAIN.CPP에서

#include <set> 

이 필요했습니다. 너의 시간을 낭비하게해서 미안해. 광산을 낭비하지 않도록 도와 주셔서 감사합니다.

+1

이 헤더 파일의 이상을 보여주십시오, 문제는 그 라인 자체에서 제공하지 않을 수 있습니다 .. #include <set>해야합니다. (당신은''을 포함하고 있습니까?) – Mat

+0

사용하지 않는 C 헤더를 사용하여 종료하십시오. 그리고 좋은 C++ 책 (http://jcatki.no-ip.org/fncpp/Resources)을 얻으십시오. –

답변

1

std::set을 사용하려면 #include <set>이 필요합니다.

관련 문제