I don't see any problem with the shared code. Unless that's all of your code. You need to have a main() function in your code: that's the entry point of the program.
uniform.h
#ifndef UNIFORM_H
#define UNIFORM_H
double unif();
double unif(double a, double b);
long unif(long a);
void seed();
#endif // UNIFORM_H
uniform.cpp
#include <cmath>
#include <cstdlib>
#include <ctime>
#include "uniform.h"
using namespace std;
double unif()
{
return rand() / double(RAND_MAX);
}
double unif(double a, double b)
{
return (b-a)*unif() + a;
}
long unif(long a)
{
if (a < 0) a = -a;
if (a==0) return 0;
return long(unif()*a) + 1;
}
void seed()
{
srand(time(0));
}main.cpp
#include <iostream>
#include "uniform.h"
int main()
{
seed();
for (int i = 0; i < 10; i++)
std::cout << unif() << std::endl;
return 0;
}