I made a program, I want to debug it (or run) and before the first operator in function main it breaks with a message: Unhandled exception at 0x0020f677 in name.exe: Stack overflow.
Why is this happening and how to resolve the problem?
Visual C++ 2010, Win32 console application.
Debugger shows me the asm code at chkstk.asm.
What is important to analyse in order to solve this problem? Something added in header files is causing this problem?
If you decleared a fixed size array and if its size is too much, you may have this error.
Try to decrease the length or create it on the heap.
int * array = new int;
Do not forget to delete it later.
But it is better to use std::vector instead of pointers even in a C function,
//... int Old_C_Func(int * ptrs, unsigned len_); //... std::vector<int> intvec(1000000000); int * intptr = &intvec; int result = Old_C_Func(intptr,intvec.size());
assuming 32bit compilation.