Start New Discussion within our Software Development Community

Can somebody please tell me what am I doing wrong?
I have created a so called "game" and I have decided to add some random events. That's where I got this nasty error which I do not know how to dispose of.

#ifndef FUNC_H
#define FUNC_H

#include <iostream>
#include <string>
#include <ctime>
#include <cstdlib>
using namespace std;

 srand /*HERE IS THE ERROR*/( time(NULL) );
 int random_event_number = (rand()%100)+1;

ERROR :
func.h:10:7: error: expected constructor, destructor, or type conversion before '(' token

EXTRA INFO : I am using Linux OS, Vim text editor and g++ compiler.
Here are the files of my game:
http://www.2shared.com/file/0cKHjMcI/func.html
http://www.2shared.com/file/zrokTSml/average_life.html

You have helped me before and I know you can help me with this one too :)
Thanks!

You can't have executable code outside of a function body. Move those parts to main():

int random_event_number;

int main()
{
    srand(time(NULL));

    random_event_number = rand() % 100 + 1;

    ....
}
This question has already been answered. Start a new discussion instead.