mingw gcc math.h problem

Gert Kello gert.kello at gmail.com
Mon Nov 29 15:01:35 CET 2010


Hi.

I have dev-util/mingw-w32-20100605
If I try to compile digikam it errors out at

[  0%] Building CXX object
digikam/CMakeFiles/digikamcore.dir/__/libs/dimg/filters/sharp/matrix.obj
In file included from
e:\kde4\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.5/../../../../include/c++/4.4.5/cmath:46,
                 from
E:\Kde4Devel\GoSC2010\digikam\libs\dimg\filters\sharp\matrix.cpp:45:
e:\kde4\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.5/../../../../i686-w64-mingw32/include/math.h:125:
error: expected unqualified-id before 'int'
e:\kde4\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.5/../../../../i686-w64-mingw32/include/math.h:125:
error: expected ')' before 'int'
e:\kde4\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.5/../../../../i686-w64-mingw32/include/math.h:125:
error: expected ')' before 'int'
make[2]: *** [digikam/CMakeFiles/digikamcore.dir/__/libs/dimg/filters/sharp/matrix.obj]
Error 1
make[1]: *** [digikam/CMakeFiles/digikamcore.dir/all] Error 2
make: *** [all] Error 2

I figured out that it is caused by "abs" being already defined. I'm
not qualified in C/C++, so what and where needs to be adjusted?

(I did change
#ifndef _CRT_ABS_DEFINED
#define _CRT_ABS_DEFINED
  int __cdecl abs(int _X);
  long __cdecl labs(long _X);
#endif

to
#ifndef _CRT_ABS_DEFINED
#define _CRT_ABS_DEFINED
#ifndef abs
  int __cdecl abs(int _X);
#endif
#ifndef labs
  long __cdecl labs(long _X);
#endif
#endif

and this point seems to compile now)

Gert


More information about the Kde-windows mailing list