NO

Author Topic: error in malloc.h  (Read 8969 times)

Seltsamuel

  • Guest
error in malloc.h
« on: June 01, 2009, 07:33:49 PM »
Hi,

i tried to compile a static linked allegro testfile wich included as it seems malloc.h as most platform independend sources do.

Use <stdlib.h> instead of non-standard <malloc.h>
C:\PellesC\Include\Win\malloc.h(33): error #2001: Syntax error: expected ')' but found '('.
C:\PellesC\Include\Win\malloc.h(33): error #2120: Redeclaration of 'size_t', previously declared at C:\PellesC\Include\stddef.h(34); expected 'unsigned int' but found 'void'.
C:\PellesC\Include\Win\malloc.h(33): error #2001: Syntax error: expected ';' but found ')'.

Another error is the message  "Use <stdlib.h> instead of non-standard <malloc.h>" appearing because i switched warning to NONE.

Greetings

Seltsamuel

Offline AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • Alex's Link Sammlung
Re: error in malloc.h
« Reply #1 on: June 01, 2009, 09:58:09 PM »
i tried to compile a static linked allegro testfile wich included as it seems malloc.h as most platform independend sources do.


Another error is the message  "Use <stdlib.h> instead of non-standard <malloc.h>" appearing because i switched warning to NONE.


Look at that task http://forum.pellesc.de/index.php?topic=2844.0
best regards
 Alex ;)

Seltsamuel

  • Guest
Re: error in malloc.h
« Reply #2 on: June 02, 2009, 12:16:22 AM »
Hi,

oh thanks not seen that. So only the last part (warning set to none) should be considered.
Maybe it would be nice to have a project checkbox POSIXAWARE or something like this to disable warnings and messages of this type.
When porting libs and code from open source projects this type of messages is unnecessary because someone porting has no influence on the ported code as far as its posix and c99 compliant. My opinion is there is only a demand in compiling it and not in rewriting it ;-)

EDIT:
The fix suggested by Pelle does NOT work!

Use <stdlib.h> instead of non-standard <malloc.h>
C:\PellesC\Include\Win\malloc.h(33): error #2001: Syntax error: expected ')' but found '('.
C:\PellesC\Include\Win\malloc.h(33): error #2120: Redeclaration of 'size_t', previously declared at C:\PellesC\Include\stddef.h(34); expected 'unsigned int' but found 'void'.
C:\PellesC\Include\Win\malloc.h(33): error #2001: Syntax error: expected ';' but found ')'.

There is still a type conflict


Greetings

Seltsamuel
« Last Edit: June 02, 2009, 12:28:55 AM by Seltsamuel »

Offline AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • Alex's Link Sammlung
Re: error in malloc.h
« Reply #3 on: June 02, 2009, 08:45:06 PM »

EDIT:
The fix suggested by Pelle does NOT work!

Use <stdlib.h> instead of non-standard <malloc.h>
C:\PellesC\Include\Win\malloc.h(33): error #2001: Syntax error: expected ')' but found '('.
C:\PellesC\Include\Win\malloc.h(33): error #2120: Redeclaration of 'size_t', previously declared at C:\PellesC\Include\stddef.h(34); expected 'unsigned int' but found 'void'.
C:\PellesC\Include\Win\malloc.h(33): error #2001: Syntax error: expected ';' but found ')'.

There is still a type conflict

Yes you are right, but I have the hope that Pelle before he builds RC3 makes a C-source file where he includes all his header files and there should be any bad errors.  ;)

Will you do such a thing Pelle?  (I know it's a hard piece of work because you have to maintain up to 5 compilers (win32: x86,ARM Win64: x64, x86, ARM), with and without UNICODE ...)
best regards
 Alex ;)

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: error in malloc.h
« Reply #4 on: June 16, 2009, 09:17:05 PM »
I don't get paid to test (or for that matter, much else) - this is your job!
/Pelle

MirekCZ

  • Guest
Re: error in malloc.h
« Reply #5 on: June 01, 2011, 11:00:05 AM »
I don't get paid to test (or for that matter, much else) - this is your job!

I got similar warning (during linking executable with SDL libraries):
   Building main.obj.
   Use <stdlib.h> instead of non-standard <malloc.h>
   Building Test.exe.
   Done.
No problem, success. But I don't like bold type of text (compilation error causes paranioa in my old head.- ;) ) than I found, that only ONE file who shoot to malloc.h is SDL_stdinc.h (from SDL distrib). I test to edit it, 4times change refferred <malloc.h> to <stdlib.h> (lines 48,191,194,196) and everything goes like a Switzerland wath! (fyi: SDL-1.2.14, PellesC 6.50.8)

GreenHornet

  • Guest
Re: error in malloc.h
« Reply #6 on: August 21, 2011, 01:37:48 AM »
I had the same kind of problem when I tried to build a test SDL program. Except I also got the error of a missing file named MSVCRT.LIB. So I never even made it to the EXE file. :P


GH