For a uni project I have to use the ANSI C code supplied in the GSM speech coding standard from 1996. the zip archive can be found here https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=281
I have a MacBook Pro running OS X 10.11.6.
when trying to compile all the different files in its /C directory (main directory) with xcode installed in terminal using clang:
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
it gives multiple errors like:
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 */
I assume this is because of the new compiler having functions defined that weren't defined back then?
Anyways, what is the easiest way for me to make this code usable?
POSIX (and other standardisation bodies) define a C function
roundthat takes and returns a floating point type. The functionroundthat seems to be declared in yourmathhalf.hfile is probably implemented in themathhalf.cfile and takes and returns integer types (32 and 16 bits, apparently). This function clashes with theroundthat comes with the compiler.Assuming the function is implemented in
mathhalf.c, simply rename it to, for example,intRoundin both the .c and the .h file.