//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?

Put the srand() functionn call back in main() .

And where's the header that define the random functions?

srand is in cstdlib. So try to include cstdlib.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.