views:

130

answers:

1

Greetings.

I am trying to compile a 8hz mp3 encoder - C code in QT Creator.

In a file l3psy.c that starts like this

#include <stdio.h>

#include "types.h"
#include "error.h"
#include "layer3.h"
#include "l3psy.h"

#include "fft.h"
#include "tables.h"

The build step complains about PI being undeclared here

for(i=0;i<BLKSIZE;i++)  window[i]  = 0.5*(1-cos(2.0*PI*(i-0.5)/BLKSIZE));

But types.h, which is obviously included, starts like this:

#ifndef TYPES_H
#define TYPES_H

#include <stdio.h>
#include <time.h>
#include "portableio.h"


#ifdef PI
#undef PI
#define         PI                      3.14159265358979
#endif

#define         PI4                     .78539816339745
#define         PI64                    .049087385212

therefore, there is no way for PI to be undeclared.

What can be the problem here?


also, aside from that stopper, i also get complains about "implict declaration of funtion abort" and "implict declaration of funtion exit" and "incompatible implicit declaration of built-in function 'exit'", but, they are standart functions of c, why would it complain?

+3  A: 

For the first problem, about PI, see Pascal Cuoq's comment (that's all).

For the problems with implicit declarations being reported, you haven't included the relevant header(s) for those functions. IIRC exit and abort are declared by <stdlib.h. But check it out.

Cheers & hth.,

Alf P. Steinbach
Yes indeed. That helped! Thanks.
Istrebitel