News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Compile errors from mingw32's math.h of Code::Blocks v10.05 rev 6283

Started by ophiuchus18, July 20, 2011, 01:17:40 PM

Previous topic - Next topic

ophiuchus18

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 ?

ollydbg

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.

ophiuchus18

Quote from: 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?

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

xunxun

Regards,
xunxun

ophiuchus18

Quote from: xunxun1982 on July 20, 2011, 03:24:46 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

ouch

I would re-install, something got messed up if the default headers don't compile.

stahta01

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

/* 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

 43 #if !HAVE_LOG2F
 44 #define log2f(x) (logf(x)/0.693147180559945f)
 45 #define log2(x) (log(x)/0.693147180559945)
 46 #endif


Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

ophiuchus18

Quote from: 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

/* 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

 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.