编译 C 代码,没有看到 #define'd 常量

发布于 2024-09-29 16:15:01 字数 882 浏览 1 评论 0 原文

我正在尝试在 QT Creator 中编译 8hz mp3 编码器 - C 代码。

在像这样开始的文件 l3psy.c 中,

#include <stdio.h>

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

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

构建步骤抱怨 PI 在这里未声明

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

,但是显然包含在内的 types.h 是这样开始的:

#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

因此,PI 无法未声明。

这里可能有什么问题?


另外,除了那个停止器之外,我还收到关于“函数中止的隐式声明”和“函数退出的隐式声明”和“内置函数'exit'的不兼容的隐式声明”的抱怨,但是,它们是 c 的标准函数,为什么会抱怨呢?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愛放△進行李 2024-10-06 16:15:01

对于第一个问题,关于 PI,请参阅 Pascal Cuoq 的评论(仅此而已)。

对于报告的隐式声明问题,您尚未包含这些函数的相关标头。 IIRC exitabort 声明。但检查一下。

干杯&呵呵,

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文