Help needed with MSC error 'main' > 32K

Walter Bright bright at nazgul.UUCP
Sat Nov 24 08:22:36 AEST 1990


In article <20279.2749b4b0 at oregon.uoregon.edu> michelbi at oregon.uoregon.edu writes:
/I am having trouble with a fatal compilation error in Microsoft C 6.0 and
/QuickC 2.5.  The error message is as follows:
/    fatal error C1126: 'main' : automatic allocation exceeds 32K
/The only unusual thing that I can see with my main is the size of 4 arrays,
/each having 5000 float elements.  If I declare these arrays global to the
/program (ie before 'main()' declaration) the program will compile just fine.


I assume your program looks like:
	main()
	{	float a[5000]; float b[5000]; float c[5000]; float d[5000];
		...
	}
A bit of multiplication gives us 80,000 bytes you are trying to allocate
on the stack. The PC hardware only allows a 64k byte stack, MSC allows
something less than that.

You'll need to allocate arrays that large statically, or use malloc() to
dynamically generate storage for them.



More information about the Comp.lang.c mailing list