Reputation: 6252
So here's a snippet of my code:
struct dv_nexthop_cost_pair
{
unsigned short nexthop;
unsigned int cost;
};
map<unsigned short, vector<struct dv_nexthop_cost_pair> > dv;
I'm getting the following compiler error:
error: ISO C++ forbids declaration of `map' with no type
What's the proper way to declare this?
Upvotes: 5
Views: 1840
Reputation: 1
use typedef
typedef std::map<unsigned short, std::vector<struct dv_nexthop_cost_pair> > dvnexthopemap;
dvnexthopemap db;
Upvotes: 0
Reputation: 186078
Either you forgot to #include the right headers or didn't import the std
namespace. I suggest the following:
#include <map>
#include <vector>
std::map<unsigned short, std::vector<struct dv_nexthop_cost_pair> > dv;
Upvotes: 8