Author Topic: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283  (Read 10540 times)

Offline ophiuchus18

  • Single posting newcomer
  • *
  • Posts: 4
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 ?
« Last Edit: July 20, 2011, 01:21:38 pm by ophiuchus18 »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ophiuchus18

  • Single posting newcomer
  • *
  • Posts: 4
Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
« Reply #2 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?

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 ===|

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
« Reply #3 on: July 20, 2011, 03:24:46 pm »
Don't put your compiler into the directories with spaces.
Regards,
xunxun

Offline ophiuchus18

  • Single posting newcomer
  • *
  • Posts: 4
Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
« Reply #4 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

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
« Reply #5 on: July 20, 2011, 05:47:28 pm »
I would re-install, something got messed up if the default headers don't compile.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7590
    • My Best Post
Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
« Reply #6 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
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.
« Last Edit: July 20, 2011, 07:13:33 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ophiuchus18

  • Single posting newcomer
  • *
  • Posts: 4
Re: Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283
« Reply #7 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
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.