I have 3 files
main.cpp
random.cpp
random.h
they contain this:
main.cpp -
Code:
#include <iostream>
#include <cstdlib> // library for rand(); function
#include "random.h" // My library
using namespace std;
int main()
{
random(1,2);
return 0;
}
random -
Code:
#include <iostream>
#include <cstdlib> // library for rand(); function
#include "random.h" // My library
#include <sys/types.h> // library for time_t time(time_t*);
using namespace std;
int random(int argument1, int argument2)
{
int returnValue = 0;
time_t time(time_t*); // seed for rand();
// test purpose
int sum = 0;
sum = argument1 + argument2;
cout << "rand() values:\n";
for (int i = 0; i < 50; i++) {
cout << rand() % sum << ' ';
}
system("PAUSE");
return returnValue;
}
and my problem
random.h -
Code:
int random(int argument1, int argument2);
When i try to compile (even though its barely a program) i get this error.
In function `int main()':
`random' undeclared (first use this function)
Makefile.win [Build Error] [ass2.o] Error 1
I have a good idea what this means but i have _no_ idea how to fix this. Ive searched but my google skills are lacking. Hope anyone can help