Функция 'srand' не может быть решена? (Я использую Ubuntu OS и Eclipse)
Это первый раз, когда я использую Eclipse для программирования на C++, и у меня есть проблема. Я уже включил "time.h", но ошибка (функция 'srand' не может быть решена) все еще появляется. Пожалуйста, помогите мне! Спасибо
#include "iostream"
#include "time.h"
using namespace std;
#define MAX 100
void InputArray(int a[],int n)
{
srand((unsigned)time(NULL)); //error here Function 'srand' could not be solved
a[0]=rand()%10; //and here
for(int i=1; i<n; i++)
a[i]=a[i-1] + rand()%10 + 1;
}
int main() {
int a[MAX], n;
InputArray(a,n);
return 0;
}