开发者

Compiling C code, does not see a #define'd constant

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 "implicit declaration of function abort" and "implicit declaration of function exit" and "incompatible implicit declaration of built-in function 'exit'", but, they are standard functions of c, why would it complain?


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.,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜