I have these errors on C program that may be because of random number definition. I use an SSH to compile C like in Linux. May be you have idea whether the errors are due to the random number generators in my program do not match those available from libraries in the SSH. My C program uses these libraries
Expand|Select|Wrap|Line Numbers
- #include<stdio.h>
- #include<stdlib.h>
- #include<math.h>
- #include<assert.h>
- #include<fftw3.h>
- // These are the definitions of random number generators being used,
- static unsigned long long int x = 1;
- double drand64(void) .......................................................line 1781
- {
- x = 6364136223846793005ll * x + (long long int) 1;
- return (double) x * 5.4210108624275218e-20;
- }
- void srand64(int seed).......................................................line 1787
- {
- assert(sizeof(long long int) == 8);
- x = seed;
- }
- // The calling functions
- srand48(time(NULL));
- srand64(time(NULL));........................line 778
- r1 = drand48();
- r2 = drand64();................................line 783
- /* . . . */
GlobalRevows.c( 192): warning #181: argument is incompatible with corresponding format string conversion
sizeof(real), (double) h, MAX, MAX_pass);
^
GlobalRevows.c( 778): warning #266: function declared implicitly
srand64(time(NU LL));
^
GlobalRevows.c( 783): warning #266: function declared implicitly
r2 = drand64();
^
GlobalRevows.c( 791): warning #266: function declared implicitly
r2 = drand64();
^
GlobalRevows.c( 800): warning #177: label "Next_T" was declared but never referenced
Next_T:
^
GlobalRevows.c( 1780): warning #159: declaration is incompatible with previous "drand64" (declared at line 783)
double drand64(void)
^
GlobalRevows.c( 1786): warning #159: declaration is incompatible with previous "srand64" (declared at line 778)
void srand64(int seed)
^
GlobalRevows.c( 1792): error: variable "x" has already been initialized
static unsigned long long int x = 1;
^
GlobalRevows.c( 1800): warning #147: declaration is incompatible with "void srand48(long)" (declared at line 522 of "/usr/include/stdlib.h")
void srand48(int seed)
^
Compiling with gcc gives errors something like this;
GlobalRevows1.c :1781: error: conflicting types for 'drand64'
GlobalRevows1.c :783: error: previous implicit declaration of 'drand64' was here
GlobalRevows1.c :1787: error: conflicting types for 'srand64'
GlobalRevows1.c :778: error: previous implicit declaration of 'srand64' was here
I have tried many alternative ways but none works. Any suggestion would be appreciated.
regards,