View previous topic :: View next topic |
Author |
Message |
altra22
Joined: 14 May 2007 Posts: 11
|
ex_malloc.c Compile error |
Posted: Wed Dec 29, 2010 4:53 am |
|
|
when i try to compile ex_malloc.c from examples i get errors
Code: |
Line 72(27,31): Undefined identifier cell
Line 87(44,48): Undefined identifier cell
|
my compiler version 4.105 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Wed Dec 29, 2010 8:15 am |
|
|
Er.
It is defined just a dozen lines before in the example.
'struct Cell'
Compiles 'as is' for me, with your version.
Best Wishes |
|
|
altra22
Joined: 14 May 2007 Posts: 11
|
|
Posted: Wed Dec 29, 2010 10:22 am |
|
|
I know because of that i wrote this post
to see if the problem with my compiler or the version it self?
i did compile the example file 'as-is' with these errors. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Wed Dec 29, 2010 12:59 pm |
|
|
FWIW, Version 4.114 is doing the same thing he is reporting.
The Cell struct is clearly defined right after the includes.
I copied and pasted the ex_malloc.c into a blank project I called test1 and
compiled to get exactly the error he is describing on this line:
beginCell = malloc(sizeof(Cell)); // Allocates memory using malloc()
The word Cell is highlighted in sizeof(Cell) _________________ Google and Forum Search are some of your best tools!!!! |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Dec 29, 2010 1:42 pm |
|
|
Curiously, CCS C requires sizeof(struct Cell) instead of sizeof(Cell) since some V4.09x. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Wed Dec 29, 2010 2:40 pm |
|
|
What is odder, is that the version compiles OK for me.
Didn't create a project, just compiled the code 'as is'. Have also tried 4.114, and it too works OK.
It is almost as if the creation of the project alters something, or as if my system has a different setting somewhere.....
Best Wishes |
|
|
|