D
DFS
#include <stdio.h>
#include "mt64.h"
int mersenneTwister(void) {
int i;
unsigned long long init[4]={0x12345ULL, 0x23456ULL, 0x34567ULL,
0x45678ULL}, length=4;
init_by_array64(init, length);
printf("10 outputs of genrand64_int64()\n");
for (i=0; i<10; i++) {
printf("%20llu ", genrand64_int64());
if (i%5==4) printf("\n");
}
printf("\n10 outputs of genrand64_real2()\n");
for (i=0; i<10; i++) {
printf("%10.8f ", genrand64_real2());
if (i%5==4) printf("\n");
}
return 0;
}
int main(void) {
mersenneTwister();
return 0;
}
[dfs@home src]$ gcc -Wall mttest.c -o mttest
/tmp/cc93f16n.o: In function `mersenne_twister':
mttest.c.text+0x3f): undefined reference to `init_by_array64'
mttest.c.text+0x57): undefined reference to `genrand64_int64'
mttest.c.text+0xba): undefined reference to `genrand64_real2'
collect2: error: ld returned 1 exit status
mt64.h is in the same directory as the source file, of course.
It also fails to build if I remove the #include "mt64.h" and add in the
function declarations from the header file:
void init_by_array64(unsigned long long init_key[],
unsigned long long key_length);
unsigned long long genrand64_int64(void);
double genrand64_real2(void);
Wazzup?
#include "mt64.h"
int mersenneTwister(void) {
int i;
unsigned long long init[4]={0x12345ULL, 0x23456ULL, 0x34567ULL,
0x45678ULL}, length=4;
init_by_array64(init, length);
printf("10 outputs of genrand64_int64()\n");
for (i=0; i<10; i++) {
printf("%20llu ", genrand64_int64());
if (i%5==4) printf("\n");
}
printf("\n10 outputs of genrand64_real2()\n");
for (i=0; i<10; i++) {
printf("%10.8f ", genrand64_real2());
if (i%5==4) printf("\n");
}
return 0;
}
int main(void) {
mersenneTwister();
return 0;
}
[dfs@home src]$ gcc -Wall mttest.c -o mttest
/tmp/cc93f16n.o: In function `mersenne_twister':
mttest.c.text+0x3f): undefined reference to `init_by_array64'
mttest.c.text+0x57): undefined reference to `genrand64_int64'
mttest.c.text+0xba): undefined reference to `genrand64_real2'
collect2: error: ld returned 1 exit status
mt64.h is in the same directory as the source file, of course.
It also fails to build if I remove the #include "mt64.h" and add in the
function declarations from the header file:
void init_by_array64(unsigned long long init_key[],
unsigned long long key_length);
unsigned long long genrand64_int64(void);
double genrand64_real2(void);
Wazzup?