当我这样做时,我的编译器会抱怨。出现了 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;
};
编译器不喜欢我的vector<Node> storage
声明。相反,当我这样做时vector<int> storage
,它会毫无怨言地编译。在另一个类中声明一个类的对象是错误的吗?我以为这没问题。