2

ユーザー定義の構造体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 ‘&lt;’ token

なぜ私はこのようにすることができないのですか?

ファイル: Logger.h

#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
4

2 に答える 2

9

deque の名前空間が定義されていません:

std::deque<MotorPoint> motorPlotData;

また

using namespace std;
// ...

deque<MotorPoint> motorPlotData;
于 2010-02-24T13:48:34.900 に答える
5

deque は名前空間 std にあるため、std::deque.

于 2010-02-24T13:48:17.380 に答える