[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] compiling problem



min is often declared as a macro.  And if you look in math.h from
mintlib, you'll see :

#   define min(x,y) ({typeof(x) _x=(x); typeof(y) _y=(y); if (_x<_y)
_y=_x; _y;})

Now look at the function below and imagine what happens when 

	static int min(int a, int b) {

gets expanded!  It will something like this :

	static int {typeof(int a) _x=(int a); typeof(int b) _y=(int b); if
(_x<_y) _y=_x; _y;} {

Now look at your error message below.  Make sense?

-- Evan (SoT)


On Thu, 2005-04-28 at 11:01 +0200, Martin Tarenskeen wrote:
> Hi,
> 
> Now that I have sox-12.17.7 compiled and running on my Linux FC3 system, 
> I'm trying to make a version for MiNT. But while compiling, I get stuck on 
> the following error message:
> 
> <--SNIP-->
> cd src && make all
> make[1]: Entering directory `/d/usr/src/redhat/BUILD/sox-12.17.7/src'
> m68k-atari-mint-gcc -O2 -fomit-frame-pointer -Wall -I. -I.  -c noiseprof.c
> In file included from noiseprof.c:16:
> noisered.h:23: parse error before `{'
> noisered.h:23: parse error before `b'
> noisered.h:23: warning: type defaults to `int' in declaration of `_y'
> noisered.h:23: warning: data definition has no type or storage class
> noisered.h:23: parse error before `}'
> make[1]: *** [noiseprof.o] Error 1
> make[1]: Leaving directory `/d/usr/src/redhat/BUILD/sox-12.17.7/src'
> make: *** [all] Error 2
> <--SNIP-->
> 
> When I take a look into this noisered.h I can't find anything strange:
> 
> <--SNIP-->
> #include "st_i.h"
> #include "FFT.h"
> 
> #include <math.h>
> 
> #define WINDOWSIZE 2048
> #define FREQCOUNT (WINDOWSIZE/2+1)
> 
> static int min(int a, int b) {          /* this is line nr 23 */
>      if (a < b) return a;
>      else       return b;
> }
> <--SNIP-->
> 
> The author of this piece of code suggested to me to take a look at math.h, 
> which comes just before line nr. 23 in the prepocessor. Maybe one of those 
> smart ;-) mint programmers in this mailing list can help me find/fix this 
> problem ? Anything wrong with math.h ?
>