There seems to be a problem in the way that I am declaring my multimap:
我声明我的multimap的方式似乎有问题:
std::multimap<int, std::string> table;
I keep getting the following error message and am quite stuck on how to solve this!
我一直收到以下错误消息,我很坚持如何解决这个问题!
error: ISO C++ forbids declaration of ‘multimap’ with no type
error: invalid use of ‘::’
error: expected ‘;’ before ‘<’ token
This is my first time trying multimap in C++, and I'm sorry if this seems a trivial problem. Could someone please point me in the right direction?
这是我第一次在C ++中尝试多图,如果这看起来像是一个小问题,我很抱歉。有人可以指出我正确的方向吗?
In my central.h I have the following code
在我的central.h中,我有以下代码
class Central{
private:
int address;
std::multimap<int, std::string> table;
public:
Central(int _address);
In central.cpp:
#include <iostream>
#include <string>
#include <sstream>
#include <map>
using namespace std;
#include "central.h"
Central::Central(int _address)
{
address = _address;
}
Thank you for your time! :)
感谢您的时间! :)
1 个解决方案
#1
4
You haven't #include
d <map>
. That's why the compiler thinks that multimap is a variable rather than a type.
你还没有#included
#1
4
You haven't #include
d <map>
. That's why the compiler thinks that multimap is a variable rather than a type.
你还没有#included