root@ozdaltx.UUCP (root) (07/20/88)
I'm running SCO XENIX 2.2.1 and am trying to compile a
program that contains the following code:
main()
{
unsigned char p[720][72];
;
}
I keep getting the following error message
test.c
test.c(2) : error 126: auto allocation exceeds 32K
I've tried using -M[sml][012], -LARGE and up to -F 52000
in all sorts of combinations in the cc comand. Can't find
anything in the manuals about the error.
What do I need to do to get this to compile???
Thanks in advance....
--
Scotty
AIDS INFORMATION EXCHANGE BBS (214) 247-2367/247-5609
"Education is the best weapon"
{ames,mit-eddie,rutgers,osu-cis,lll-winken,texsun,smu}!killer!ozdaltx!sysop
davidsen@steinmetz.ge.com (William E. Davidsen Jr) (07/20/88)
The error message is clear, you have an auto variable which is too large. Stick the word 'static' in front of it. You may have to use large model. -- bill davidsen (wedu@ge-crd.arpa) {uunet | philabs | seismo}!steinmetz!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me
root@ozdaltx.UUCP (root) (07/23/88)
Thanks to all who took time to respond both by e-mail and here. The suggestion of adding 'static' to the declaration worked like a charm. Seems like I tend to forget that many programs taken from the net are written with somewhat an attitude of 'it works for me', and I don't always pick up on possible problems. Especially after the compiler had barfed 6 or 7 times and the fustration starts mounting. I have noticed that the SCO compiler seems to be more picky about things, but at the same time forces adhearance to the K & R rules... in most cases. ;-) Again, thanks for the responces. I knew I could get an answer here. -- Scotty AIDS INFORMATION EXCHANGE BBS (214) 247-2367/247-5609 "Education is the best weapon" {ames,mit-eddie,rutgers,osu-cis,lll-winken,texsun,smu}!killer!ozdaltx!sysop
owen@wrs.UUCP (Owen DeLong) (07/22/90)
In article <5029@ozdaltx.UUCP> root@ozdaltx.UUCP (root) writes: >I'm running SCO XENIX 2.2.1 and am trying to compile a >program that contains the following code: > >main() >{ >unsigned char p[720][72]; >; >} >I keep getting the following error message > >test.c >test.c(2) : error 126: auto allocation exceeds 32K > >I've tried using -M[sml][012], -LARGE and up to -F 52000 Well, Scotty, you have a serious problem. The error message is quite self explanatory. 720*72=51840. 51840>32768. Thus, you are trying to define a static data structure larger than 32K. This is not allowed in the 286 version of SCO xenix due to the way the memory management stuff works. You have two choices. Shrink the array or split it into more than one array (which is usually the easiest solution), or Malloc it at run time and use pointers to access it. Bottom line is I found the error message in the cc: A C compiler section of Programmers Guide. The only problem was that it didn't say anything more than the error message told me. So I called SCO, and they were kind enough to say "You fool, can't you read, your array is more than 32KB. Of course you can't compile it." To which I replied "Well, it would be nice if the manual gave some mention of this. They said that the manual said the same thing as the error message, and that they thought it was quite clear. So it goes. Owen P.S. Solution number 3: Buy a UNIX 4.x system on a 680x0. :-)