During startup program exited with code 0xc0000139(在启动程序以代码 0xc0000139 退出期间)
问题描述
更新:
这原来是一个编译器问题(我使用的是 MinGW)所以 解决方法 正在切换到另一个编译器(在这种情况下 Cygwin).
This turned out to be a compiler issue (I was using MinGW) so a workaround is switching to another compiler (in this case Cygwin).
(原始)问题
我是一名开始自学C++的学生,在尝试使用string
I'm a student starting to learn C++ by myself and I have come across a problem when trying to work with string
这是我的测试代码(不工作的那个)
This is my test code (the one that isn't working)
#include <iostream>
#include <string>
using namespace std;
int main()
{
string myString;
cin >> myString;
cout << myString;
return(0);
}
当我尝试运行它时,程序刚刚结束并退出在我可以输入任何内容之前,这是我尝试从 gdb
运行时的结果
When I tried to run it, the program just ended and exited before I can input anything, and this is the result when I tried to run from gdb
(gdb) run
Starting program: C:UsersDANIEL~1AppDataLocalTempsandbox.exe
[New Thread 15036.0x31bc]
[New Thread 15036.0x2db4]
[New Thread 15036.0x2628]
[New Thread 15036.0x2280]
During startup program exited with code 0xc0000139.
(gdb)
当我尝试制作文件并从 cmd 运行它时
When I tried to make the file and run it from cmd
g++ sandbox_string.cpp -o sandbox_string
(我添加了_string与_int makefile分开,程序还是一样)
(I added the _string to separate from the _int makefile, the program is still the same)
我收到了这个错误:找不到入口点
在访问 Google 之后,我认为这个问题与 缺少 DLL 有关.我怎样才能知道我缺少哪些 dll,有没有办法确保我拥有每个 dll?
After a trip round Google I believe that this problem is related to missing DLLs. How can I know what dll(s) I'm missing and is there a way to make sure I have every dlls ?
有几点我想提一下:
• 我知道这可能与 为什么我的所有 C++ 程序都以 0xc0000139 退出?,但除了降级 GCC 之外没有提供任何解决方案.我试过了,但没有用.同样在那个问题中,有人提到了缺少 DLL,但没有提供进一步的解决方案.
• I'm acknowledged that this may be a duplicate to Why are all my C++ programs exiting with 0xc0000139?, but that provided no solution other than downgrading GCC. I tried that and it didn't work. Also in that question someone mentioned about missing DLLs, but provided no further solution.
• 如果我尝试cin
一个整数,例如:
• If I tried to cin
an integer for example:
#include <iostream>
#include <string>
using namespace std;
int main()
{
int myString;
cin >> myString;
cout << myString;
return(0);
}
效果很好,我可以输入,程序会输出然后正常退出:
It works fine, I can input and the program would output then exit normally:
(gdb) run
Starting program: C:UsersDANIEL~1AppDataLocalTempsandbox.exe
[New Thread 9120.0x35ac]
[New Thread 9120.0x2c4c]
[New Thread 9120.0x390c]
[New Thread 9120.0x32c0]
7
7[Inferior 1 (process 9120) exited normally]
(gdb)
• 我的编译器是 MinGW,这是我的 MinGW 安装程序屏幕截图,其中包含(希望)您需要的所有细节MinGW 安装程序
• My compiler is MinGW, this is my MinGW installer screenshot with (hopefully) every details you need MinGW Installer
• 我正在使用 Atom - 一个文本编辑器,带有一个用于编译和运行 C++ 代码的插件(称为gpp-compiler"),因为我觉得坚持使用一个文本编辑器很舒服使用 IDE,但是,如果您认为我应该使用其他东西,请告诉我.
• I'm using Atom - a text editor, with a plugin to compile and run C++ code (called "gpp-compiler") because I find it comfortable to stick with one text editor instead of using IDEs, but, if you think there's something else I should be using, please let me know.
• 我对编程并不陌生,但我(非常)对 C++ 很陌生,所以如果有任何愚蠢的错误,请原谅我,这也意味着我非常喜欢如果可能的话,我更喜欢简单的答案/解决方案强>.但是我对带有适当解释的复杂答案没有任何问题.
• I'm not new to programming but I'm (very) new to C++ so please pardon me if there is any silly mistake, also this also means that I greatly prefer simple answer/solution if possible. But I will have no problem with complicated answer that's accompanied by a proper explanation.
谢谢
推荐答案
代码好像没有错误.但正如上面提到的,这是一个编译器问题,所以从 MinGW 切换到 Cygwin 已经解决了这个错误.
The code seems to have no errors. but as it mentioned above this has been a compiler issue so switching to Cygwin from MinGW has solved the error.
错误代码 0xc0000139 出现在配置错误、重要文件丢失或损坏时.所以切换到一个完全不同的编译器已经解决了这个问题.
The error code 0xc0000139 appears when mis-configured, important files gone missing or damaged. so switching in to a totally different compiler has solved the problem.
希望这将有助于改善这个问题价值@Daniel D.
hope this will help to improve this questions value @Daniel D.
这篇关于在启动程序以代码 0xc0000139 退出期间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在启动程序以代码 0xc0000139 退出期间
基础教程推荐
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 从 std::cin 读取密码 2021-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01