[英]Deque of user-defined structures
我有一個用戶定義的結構struct theName
,我想讓這些結構的deque<theName> theVar
( 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
deque的名稱空間未定義:
std::deque<MotorPoint> motorPlotData;
要么
using namespace std;
// ...
deque<MotorPoint> motorPlotData;
deque在命名空間std中,所以std :: deque。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.