windows Cygwin 编译错误:“此应用程序已请求运行时以异常方式终止它”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2151257/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cygwin compiling error: "this application has requested the runtime to terminate it in an unusual way"
提问by naspinski
I am trying to run Cygwin, and I am running into some problems. I tried to compile a program that works both on Windows with mingw and on a Unix system, but when I go to compile it through Cygwin:
我正在尝试运行 Cygwin,但遇到了一些问题。我试图编译一个既可以在 Windows 上使用 mingw 也可以在 Unix 系统上运行的程序,但是当我通过 Cygwin 编译它时:
gcc threads.c -o threads
I get the error: this application has requested the runtime to terminate it in an unusual way
我收到错误: 此应用程序已请求运行时以异常方式终止它
And that's it... any ideas what I am forgetting or screwing up? I haven't touched this stuff in about 5 years so I am beyond rusty; thanks!
就是这样......有什么想法我忘记或搞砸了吗?我已经有大约 5 年没有碰过这些东西了,所以我已经生疏了;谢谢!
采纳答案by Warren Young
The error message means the compiler crashed while trying to build your program.
该错误消息意味着编译器在尝试构建您的程序时崩溃了。
Most likely this means your Cygwin installation is corrupt or happens to include a broken version of gcc. Try updating to the current version of Cygwin. This is doubly the case given that Cygwin 1.7 and the first stable releases of GCC 4 are both recent happenings. If you're still on Cygwin 1.5 or GCC 3.x, I think there's an excellent chance that upgrading will fix your symptom.
这很可能意味着您的 Cygwin 安装已损坏或碰巧包含损坏的 gcc 版本。尝试更新到 Cygwin 的当前版本。考虑到 Cygwin 1.7 和 GCC 4 的第一个稳定版本都是最近发生的,情况更是如此。如果您仍在使用 Cygwin 1.5 或 GCC 3.x,我认为升级很有可能会解决您的症状。
回答by George Norton
In my case this problem was caused by the fact I didn't have a TEMP environment variable defined in cygwin, try:
在我的情况下,这个问题是由于我没有在 cygwin 中定义 TEMP 环境变量造成的,请尝试:
export TEMP=/tmp
If TEMP is already defined make sure the directory is not read only.
如果已经定义了 TEMP,请确保该目录不是只读的。
回答by t0mm13b
Assuming you are compiling threads.c which I would gather has something to do with threads, have you tried this...
假设您正在编译我认为与线程有关的threads.c,您是否尝试过这个...
gcc -L libthreads -o threads threads.c
This is telling the gcc
compiler to include the library threads and link it together.
这告诉gcc
编译器包含库线程并将其链接在一起。
Or... you could include the switch into the above command line -mno-cygwin
if you
don't need the unix-like behaviour.
或者...-mno-cygwin
如果您不需要类似 Unix 的行为,您可以将开关包含在上面的命令行中。
Hope this helps, Best regards, Tom.
希望这会有所帮助,最好的问候,汤姆。