Hi guys,

I haven't a clue why this won't compile! I think the compiler is confusing multiplies as pointers. Here's my code:

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#define pi 3.14159265;

double data[] = 
{
-0.15709,-0.25413,-0.1545,-0.011505,-0.052141,-0.24125,-0.28251,0.020464,0.48291,0.69804,0.46961,0.019997,
-0.26036,-0.22194,-0.059284,-0.027764,-0.14373,-0.21843,-0.14153,-0.030971,-0.060482,-0.19966,
-0.217,0.037288,0.41287,0.58642,0.40239,0.036834,-0.19954,-0.1839,-0.06484,-0.042241,-0.13189,-0.18949,-0.12998,
-0.044059,-0.064511,-0.16527,-0.1656,0.048371,0.35412,0.8441,0.76091,-0.086579,-0.56076,-0.38969,
-0.0037447,0.066327,-0.19043,-0.35463,-0.18658,0.055369,-0.015147,-0.35243,-0.4718,
-0.038401,0.66734,0.99976,0.64583,-0.038856,-0.43599,-0.32307,-0.031074,0.023928,-0.17255,-0.29875,
-0.16944,0.016309,-0.037833,-0.29157,-0.36583,-0.0038886,0.56681,0.834,0.54992,-0.0043523,-0.33768,-0.2678,
-0.048722,-0.0065075,-0.15722,-0.25426,-0.15463,-0.011604,-0.052198,-0.24126,
-0.28247,0.020554,0.48303,0.69817,0.46973,0.020092,-0.26031,-0.22194,-0.059329,-0.027849,-0.14384,-0.21855,
-0.14164,-0.031061,-0.060533,-0.19967,-0.21696,0.037369,0.41298,0.58653,0.4025,0.036919,-0.19949,-0.1839,-0.06488,
-0.042318,-0.13199,-0.1896,-0.13009,-0.044141,-0.064557,-0.16527,-0.16556,0.048444,0.35422,0.84421,0.76101,
-0.086502,-0.56072,-0.38968,-0.0037807,0.066258,-0.19052,-0.35473,-0.18667,0.055296,-0.015189,-0.35243,-0.47177,
-0.038335,0.66742,0.99986,0.64592,-0.038786,-0.43595,-0.32307,-0.031107,0.023865,-0.17263,-0.29884,
-0.16952,0.016243,-0.03787,-0.29157,-0.3658,-0.0038291,0.56689,0.83409,0.55,-0.0042893,-0.33765,-0.26779,
-0.048751,-0.006564,-0.15729,-0.25435,-0.15471,-0.011664,-0.052232,-0.24126
};

int main(void)
{
  int i;
  int size = sizeof(data) / sizeof(data[0]);
  double windowed_data[166];

printf("%d", size);

  for (i=0;i<size;i++)
	{
		windowed_data[i] = 0.5*(1-cos(2*pi*i/(size-1)))*data[i];
		//printf("%lf\n",  windowed_data[i]); 
	}
  return 0;
}

The problem is on line 35. Maybe my syntax is wrong? I'm trying to create a Hanning window.
Thanks,
Ger.

>#define pi 3.14159265;
Lose the semicolon. The preprocessor is doing exactly what you tell it and replacing all occurrences of "pi" with "3.14159265;".

Ah, silly me! Thanks Narue!
Ger.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.