//file included from main.cpp
#include <iostream>
#include <ctime>
void generate(int height, int width)
{
int i,j,random,x,y,check;
char map[height][width];
bool way[4], border[3];
srand(time(NULL)); //[error 'srand' was not declared in this scope]
for(i=0; i<height; i++)
{
for(j=0; j<width; j++)
map[i][j] = 178;
}
x = rand()%height; //[error: 'rand' was not declared in this scope]
y = rand()%width; //[error: 'rand' was not declared in this scope]
map[x][y] = 'x';
//...
}
This file is included from main.cpp. When this function was in main file there wasn't any trouble. I tried to use headers and split main to:
main.cpp
header.h
funct.cpp
What's wrong in this?