小编San*_*raj的帖子

为什么我不能在班上做这个对象声明?

当我这样做时,我的编译器抱怨.虽然没有可见的错误消息,但会出现3个错误:

#include <stdlib.h>
#include <vector>
#include <string>
#include "ParseException.h"
#include "CycleFoundException.h"
#include "UnknownTargetException.h"

using namespace std;

class Maker
{
 private:
 vector<Node> storage;

 public:
 Maker(string file) throw (ParseException, CycleFoundException, UnknownTargetException);
 vector<string> makeTarget(string targetName);      
};

struct Node
{
    string target;
    vector<string> dependencies;
    string command;
    int discoverytime;
    int finishtime;
    int visited;
    Node* next;
};
Run Code Online (Sandbox Code Playgroud)

编译器不喜欢我的vector<Node> storage声明.当我这样做时vector<int> storage,它编译没有抱怨.在另一个类中声明一个类的对象是错误的吗?我觉得这没关系.

c++ class object

1
推荐指数
1
解决办法
86
查看次数

标签 统计

c++ ×1

class ×1

object ×1