I downloaded this source code (.zip) and would like to compile it on my Mac (OSX 10.11.2) with an XCode Version 7.2 (7C68).
I started to compile the file fdist.c
with
gcc -o fdist2 -O fdist.c -lm
but it returns a long series of warnings and errors (see below). Looking at the file I see that indeed it does not quite look as the kind of code I am used to. Typically, it appears that the type of object the functions returned are unspecified.
The README_fdist2
did not help much. There are guidelines on how to compile the code but there is a typo in the first line.
How should I compile this code?
Below are the errors and warnings the command gcc -o fdist2 -O fdist.c -lm
returned
fdist2.c:42:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
fdist2.c:117:3: warning: implicit declaration of function 'sim1' is invalid in C99
[-Wimplicit-function-declaration]
sim1(init,initot,rm,mu,freq_arr,val_arr,&noall);
^
fdist2.c:119:4: warning: implicit declaration of function 'my_thetacal' is invalid in C99
[-Wimplicit-function-declaration]
my_thetacal(freq_arr,noall,init,Subs,&h0,&h1,&fst);
^
fdist2.c:136:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
sim1(init,initot,rm,mu,freq_arr,val_arr,noall)
^
fdist2.c:222:3: warning: implicit declaration of function 'dfill' is invalid in C99
[-Wimplicit-function-declaration]
dfill();
^
fdist2.c:234:4: warning: implicit declaration of function 'cnode' is invalid in C99
[-Wimplicit-function-declaration]
cnode(k);
^
fdist2.c:237:8: warning: implicit declaration of function 'mnode' is invalid in C99
[-Wimplicit-function-declaration]
else mnode(k);
^
fdist2.c:252:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
fdist2.c:254:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
thetacal(gen,noall,sample_size,no_of_samples,het0,het1,fst)
^
fdist2.c:293:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
fdist2.c:301:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
dfill()
^
fdist2.c:312:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
fdist2.c:315:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
cnode(sp)
^
fdist2.c:349:2: error: non-void function 'cnode' should return a value [-Wreturn-type]
return;
^
fdist2.c:353:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
mnode(sp)
^
fdist2.c:464:2: error: non-void function 'mnode' should return a value [-Wreturn-type]
return;
^
fdist2.c:489:10: warning: implicit declaration of function 'poidev' is invalid in C99
[-Wimplicit-function-declaration]
mutno = poidev(time*mu);
^
fdist2.c:491:12: warning: implicit declaration of function 'addmut' is invalid in C99
[-Wimplicit-function-declaration]
p->dna = addmut(p->dna);
^
fdist2.c:676:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
mom(x,n,x1,x2,x3,x4,min,max)
^
fdist2.c:707:2: error: non-void function 'mom' should return a value [-Wreturn-type]
return;
^
fdist2.c:761:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
my_thetacal(gen,noall,sample_size,no_of_samples,het0,het1,fst)
^
18 warnings and 3 errors generated.