I have some code in c++ in which my main.cpp includes a file SimpleGraph.h. When I try to compile I get:
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
It then goes on to similar errors in other lines. The line 201 specified here is:
std::set<int> getConvexHullPoints() const {return convexHullPoints;}
Similar errors I have found on stackoverflow usually seem to stem from a missing ‘std::’, but here it is present. Other people I know have used SimpleGraph.h with the same compiler and had no problems. So could it be the way I am calling it in main.cpp? Here I use:
#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
Any help would be greatly appreciated.
Edit: I just needed
#include <set>
in main.cpp, as pointed out by hmjd and KennyTM. What a numpty, sorry for wasting your time. Thanks for helping me not to waste mine.
You need to
#include <set>..