Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: ophiuchus18 on July 20, 2011, 01:17:40 pm

Title: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
Post by: ophiuchus18 on July 20, 2011, 01:17:40 pm
When I compile C code,the Code::Blocks v10.05 rev 6283 default compiler (GNU GCC compiler) return these errors:

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\math.h|563|error: expected ')' before '/' token|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\math.h|564|error: expected ')' before '/' token|
||=== Build finished: 2 errors, 0 warnings ===|


C:\Program Files\CodeBlocks\MinGW\include\math.h

The mingw32's math.h is damaged or what ? How to replace the math.h with a workable one ?
Title: Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
Post by: ollydbg on July 20, 2011, 02:24:23 pm
show us the full build log.
see:
2.14 Q: How do I troubleshoot an compiler problem? (http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F)
Title: Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
Post by: ophiuchus18 on July 20, 2011, 03:18:06 pm
show us the full build log.
see:
2.14 Q: How do I troubleshoot an compiler problem? (http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F)

Build log:

Compiling: C:\x264-snapshot-20110719-2245\x264.c
In file included from C:\x264-snapshot-20110719-2245\common/osdep.h:65,
                 from C:\x264-snapshot-20110719-2245\common/common.h:87,
                 from C:\x264-snapshot-20110719-2245\x264.c:33:
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/../../../../include/math.h:563: error: expected ')' before '/' token
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/../../../../include/math.h:564: error: expected ')' before '/' token
In file included from C:\x264-snapshot-20110719-2245\common/common.h:87,
                 from C:\x264-snapshot-20110719-2245\x264.c:33:
C:\x264-snapshot-20110719-2245\common/osdep.h: In function 'x264_is_regular_file':
C:\x264-snapshot-20110719-2245\common/osdep.h:325: warning: implicit declaration of function 'fileno'
C:\x264-snapshot-20110719-2245\x264.c: In function 'main':
C:\x264-snapshot-20110719-2245\x264.c:263: warning: implicit declaration of function '_fileno'
C:\x264-snapshot-20110719-2245\x264.c: In function 'select_output':
C:\x264-snapshot-20110719-2245\x264.c:980: warning: implicit declaration of function 'strcasecmp'
Process terminated with status 1 (0 minutes, 8 seconds)
2 errors, 3 warnings

Build messages:

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\math.h|563|error: expected ')' before '/' token|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\math.h|564|error: expected ')' before '/' token|
C:\x264-snapshot-20110719-2245\common\osdep.h||In function 'x264_is_regular_file':|
C:\x264-snapshot-20110719-2245\common\osdep.h|325|warning: implicit declaration of function 'fileno'|
C:\x264-snapshot-20110719-2245\x264.c||In function 'main':|
C:\x264-snapshot-20110719-2245\x264.c|263|warning: implicit declaration of function '_fileno'|
C:\x264-snapshot-20110719-2245\x264.c||In function 'select_output':|
C:\x264-snapshot-20110719-2245\x264.c|980|warning: implicit declaration of function 'strcasecmp'|
||=== Build finished: 2 errors, 3 warnings ===|
Title: Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
Post by: xunxun on July 20, 2011, 03:24:46 pm
Don't put your compiler into the directories with spaces.
Title: Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
Post by: ophiuchus18 on July 20, 2011, 03:56:33 pm
Don't put your compiler into the directories with spaces.

This is where Code::Blocks put the compiler by default:

C:\Program Files\CodeBlocks\MinGW
Title: Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
Post by: ouch on July 20, 2011, 05:47:28 pm
I would re-install, something got messed up if the default headers don't compile.
Title: Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
Post by: stahta01 on July 20, 2011, 07:07:15 pm
You most likely have a wrong config file "config.h" for the library/compiler configuration fix it.

You can confirm by defining "HAVE_LOG2F" to see if the error changes.

This is NOT a Code::Blocks problem or even likely a Compiler problem.

From math.h starting with line 562
Code
/* 7.12.6.10 */
extern double __cdecl log2 (double);
extern float __cdecl log2f (float);
extern long double __cdecl log2l (long double);

From osdep.h http://git.videolan.org/?p=x264.git;a=blob;f=common/osdep.h;h=6249dbe0c53085167a4556ce85c4a8136abbfc90;hb=HEAD#l43 (http://git.videolan.org/?p=x264.git;a=blob;f=common/osdep.h;h=6249dbe0c53085167a4556ce85c4a8136abbfc90;hb=HEAD#l43)
Code
  43 #if !HAVE_LOG2F
  44 #define log2f(x) (logf(x)/0.693147180559945f)
  45 #define log2(x) (log(x)/0.693147180559945)
  46 #endif

Tim S.
Title: Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
Post by: ophiuchus18 on July 20, 2011, 07:31:09 pm
You most likely have a wrong config file "config.h" for the library/compiler configuration fix it.

You can confirm by defining "HAVE_LOG2F" to see if the error changes.

This is NOT a Code::Blocks problem or even likely a Compiler problem.

From math.h starting with line 562
Code
/* 7.12.6.10 */
extern double __cdecl log2 (double);
extern float __cdecl log2f (float);
extern long double __cdecl log2l (long double);

From osdep.h http://git.videolan.org/?p=x264.git;a=blob;f=common/osdep.h;h=6249dbe0c53085167a4556ce85c4a8136abbfc90;hb=HEAD#l43 (http://git.videolan.org/?p=x264.git;a=blob;f=common/osdep.h;h=6249dbe0c53085167a4556ce85c4a8136abbfc90;hb=HEAD#l43)
Code
  43 #if !HAVE_LOG2F
  44 #define log2f(x) (logf(x)/0.693147180559945f)
  45 #define log2(x) (log(x)/0.693147180559945)
  46 #endif

Tim S.

I think you have right with the config.h, it's an autogenerated file.

I downloaded cross-mingw.gcc453, MSYS.exe, Git-1.7.6.exe and yasm.exe and it's ok now. I made the .exe thing.

Thank you.