[英]C code won't run on windows (Visual Studio 2013)
My program works fine on Linux running on GCC, however when I compile and run the code on Windows using Visual Studio 2013 it gives me this error : Unhandled exception at 0x00EC2527 in a3a3.exe: 0xC00000FD: Stack overflow (parameters: 0x00000000, 0x00692000). 我的程序在GCC上运行的Linux上运行良好,但是当我使用Visual Studio 2013在Windows上编译并运行代码时,出现以下错误:a3a3.exe中0x00EC2527的未处理异常:0xC00000FD:堆栈溢出(参数:0x00000000,0x00692000) 。
It also inserts a breakpoint into crtexe.c at line 626; 它还在626行中将一个断点插入crtexe.c中。 here are lines 624 - 626 for reference:
这是第624-626行供参考:
#else /* WPRFLAG */
__initenv = envp;
mainret = main(argc, argv, envp);
I have compiled and ran C programs before using Visual Studio 2013, but this one doesn't seem to want to work and I cannot for the life of me determine why. 在使用Visual Studio 2013之前,我已经编译并运行了C程序,但是这一程序似乎并不想工作,我无法一生确定原因。 I would greatly appreciate your help, I'm fairly new to programming and this is my first post on stackoverflow.
非常感谢您的帮助,我是编程的新手,这是我有关stackoverflow的第一篇文章。 I would as well appreciate any extra tips or criticism to help me learn.
我还要感谢任何其他提示或批评,以帮助我学习。 Thank you.
谢谢。
Here is my program : http://pastebin.com/X731mU7W 这是我的程序: http : //pastebin.com/X731mU7W
struct CR CRArray[14500]
is too big to live on the stack (hence the Stack Overflow). struct CR CRArray[14500]
太大,无法struct CR CRArray[14500]
在堆栈上(因此,堆栈溢出)。 Dynamically allocate it instead. 动态分配它。
struct CR *CRArray = malloc (sizeof (struct CR) * 14500);
Although, because it's VS, you probably need to cast the return of malloc
in this instance. 尽管由于是VS,但您可能需要在此实例中
malloc
返回malloc
的返回值。
Also, don't forget to free
the memory. 另外,不要忘记
free
内存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.