このエラーは何を意味していますか?'テンプレートタイプではありません'
Generic.h:25: error: 'Generic' is not a template type
Here's Generic。
template <class T>
class Generic: public QObject, public CFG, public virtual Evaluator {
Q_OBJECT
std::string key_;
std::vector<std::string> layouts_;
std::vector<std::string> static_widgets_;
std::map<std::string, std::vector<widget_template> > widget_templates_;
std::map<std::string, Widget *> widgets_;
int type_;
LCDWrapper *wrapper_;
protected:
LCDText *lcdText_;
public:
Generic(Json::Value *config, int type);
~Generic();
void CFGSetup(std::string key);
void BuildLayouts();
void StartLayout();
int GetType() { return type_; }
//T *GetLCD() { return lcd_; }
LCDText *GetLCDText() { return lcdText_; }
virtual void Connect(){};
virtual void SetupDevice(){};
std::map<std::string, Widget *> Widgets();
std::string CFG_Key();
LCDWrapper *GetWrapper() { return wrapper_; }
};
他のクラスをサブクラス化するという問題はありますか?その理論をテストする実験を試みましたが、このエラーは発生しませんでした。
編集:Ok、私はジェネリックを他の場所でテンプレートクラスにしないで宣言することができると指摘しました。それは本当だ。テンプレートを作成すると、別のエラーが発生します。
Property.h:15:エラー:ISO C++はすぐにジェネリック上記#include
ディレクティブは閉鎖を持っているかどうかを確認するには無いタイプ
template <class T>
class Generic;
class Property : public CFG {
Generic *visitor; // line 15
bool is_valid;
QScriptValue result;
Json::Value *expression;
public:
Property(const Property &prop);
Property(Generic *v, Json::Value *section, std::string name, Json::Value *defval);
~Property();
bool Valid();
int Eval();
double P2N();
int P2INT();
std::string P2S();
void SetValue(Json::Value val);
Property operator=(Property prop);
};
ライン25は何ですか? 'Q_OBJECT'行ですか? – eduffy
だこと:クラスジェネリック:公共QObjectを、公共のCFG、パブリック仮想評価者{ – Scott
恩赦冗長性が、一般的にはかなり一般的な名前である、あなたは、わかりやすい名前に変更する場合があります。そして/または(しかしほとんどと)名前空間に配置します。 – GManNickG