对于 uni 项目,我必须使用 1996 年 GSM 语音编码标准中提供的 ANSI C 代码。 可以在此处找到 zip 存档 https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=281
我有一台运行 OS X 10.11.6 的 MacBook Pro。
当尝试使用 clang 在终端中安装 xcode 编译其 /C 目录(主目录)中的所有不同文件时:
clang dtx.c err_conc.c globdefs.c gsm_hr.c homing.c host.c mathdp31.c mathhalf.c sp_dec.c sp_enc.c sp_frm.c SP_rom.c sp_sfrm.c utils.c vad.c male.inp -o GSMHR
它会给出多个错误,例如:
In file included from dtx.c:37:
./mathhalf.h:75:11: warning: incompatible redeclaration of library function 'round' [-Wincompatible-library-redeclaration]
Shortword round(Longword L_var1); /* 1 ops */
我假设这是因为新编译器定义了当时没有定义的函数?
无论如何,对我来说让这段代码可用的最简单方法是什么?
POSIX(和其他标准化机构)定义了一个 C 函数
round
接受并返回浮点类型。 round
似乎在您的 mathhalf.h
文件中声明的函数可能在 mathhalf.c
文件中实现并获取并返回 integer 类型(显然是 32 位和 16 位)。这个函数和编译器自带的round
冲突
假设功能在
mathhalf.c
中实现,只需将其重命名为,例如,.c和.h文件中的intRound
。