sintax error & illegal indirection

I've a problem compiling this part of an header code with Visual Studio 2008.
The file is called asymg.h:

double digamma(double z) //line 102
{
int p,q,k; //line 104
p=1;
k=1; //line 106
q=(int)(p/z);
double dig=0; //line 108
for(k=1;k<=q/2-1;k++)
{ dig=dig+cos((double)(2*M_PI*p*k/q))*(log((double)sin((double)(M_PI*k/q))));
dig=dig-log((double)(2*q))-0.5*M_PI*cos((double)(p*M_PI/q))-0.57721566;}
return(dig);
}


The error messages are:

...\asymg.h(110) : error C2143: syntax error : missing ')' before ';'
...\asymg.h(110) : error C2143: syntax error : missing ')' before ';'
...\asymg.h(110) : error C2100: illegal indirection
...\asymg.h(110) : error C2059: syntax error : ')'
...\asymg.h(110) : error C2059: syntax error : ')'
...\asymg.h(110) : error C2143: syntax error : missing ')' before ';'
...\asymg.h(110) : error C2143: syntax error : missing ')' before ';'
...\asymg.h(110) : error C2143: syntax error : missing ')' before ';'
...\asymg.h(110) : error C2143: syntax error : missing ')' before ';'
...\asymg.h(110) : warning C4552: '*' : operator has no effect; expected operator with side-effect
...\asymg.h(110) : error C2100: illegal indirection
...\asymg.h(110) : error C2059: syntax error : ')'
...\asymg.h(110) : error C2059: syntax error : ')'
...\asymg.h(110) : error C2059: syntax error : ')'
...\asymg.h(110) : error C2059: syntax error : ')'
...\asymg.h(110) : warning C4552: '/' : operator has no effect; expected operator with side-effect
...\asymg.h(111) : error C2143: syntax error : missing ')' before ';'
...\asymg.h(111) : error C2143: syntax error : missing ')' before ';'
...\asymg.h(111) : error C2100: illegal indirection
...\asymg.h(111) : error C2143: syntax error : missing ';' before '/'
...\asymg.h(111) : error C2059: syntax error : ')'
...\asymg.h(111) : error C2059: syntax error : ')'


Why?? It's seems correct...
It compiles for me assuming:
 
double M_PI = 3.14;


So I suspect that M_PI in your code is giving the problem.
I can't help you with that without more information tho.
Thank you very much.
I was wrong defining M_PI.

I wrote:

#define M_PI 3.14;

with a ; at the end of the line!!!
Topic archived. No new replies allowed.