I have a problem with the following code:
Generator.h:
#pragma once
class Generator
{
public:
friend class BagObject;
Generator(void);
~Generator(void);
...
void generator(int);
private:
BagObject *object;
vector<BagObject> data; //Error c4430
};
And this is the error:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(There are 6 more errors but I believe that they should disappear after solving the above problem.)
Generator.cpp
#include "stdafx.h"
#include "Generator.h"
#include "BagObject.h"
#include <iostream>
#include <vector>
#include <ctime>
using namespace std;
Generator::Generator(void)
{
srand(time(NULL));
}
Generator::~Generator(void)
{
data.clear();
}
void Generator::generator(int ld)
{
for (int i = 0; i<ld; i++)
{
object = new BagObject(rand(),rand(),i);
data.push_back(object);
}
}
int main()
{
Generator *g = new Generator;
g->generator(10);
return 0;
}
std::vector
or include the BagObject header? – Anthocyanin