我有一个用户定义的结构struct theName
,我想要对这些结构(deque<theName> theVar
)进行双击。但是,当我尝试编译时,我收到此错误:
In file included from main.cpp:2:
Logger.h:31: error: ISO C++ forbids declaration of ‘deque’ with no type
Logger.h:31: error: expected ‘;’ before ‘<’ token
为什么我不能这样做?
#ifndef INC_LOGGER_H
#define INC_LOGGER_H
#include <deque>
#include "Motor.h"
struct MotorPoint {
double speed;
double timeOffset;
};
class Logger{
private:
Motor &motor;
Position &position;
double startTime;
(31) deque<MotorPoint> motorPlotData;
double getTimeDiff();
public:
Logger(Motor &m, Position &p);
//etc...
};
#endif
答案 0 :(得分:9)
deque的名称空间未定义:
std::deque<MotorPoint> motorPlotData;
或
using namespace std;
// ...
deque<MotorPoint> motorPlotData;
答案 1 :(得分:5)
deque在命名空间std中,所以std :: deque。