【发布时间】:2020-10-28 03:15:49
【问题描述】:
我在 Windows 上使用 vscode,并使用 mingw-w64 作为编译器。我的测试代码如下:
vector<string> words = {"SEND", "MORE"};
string result = "MONEY";
当我调试它时,我可以正确打印'words'和'result'对象,但是当我尝试使用下标时,出现了错误:
print words[0] // gdb: Could not find operator[].
更严重的是,当我尝试打印字符串的下标时,gdb 崩溃了:
print result[0]
// ERROR: GDB exited unexpectedly with exit code -1073741819 (0xC0000005). Debugging will now abort.
无论是使用 vscode 调试还是手动在 cmd shell 中使用 gdb,这些错误都会发生。 但是,当我使用 gdb 在 linux 平台上调试时,它可以完美运行。这让我很困惑。我找不到mingw中是否有任何错误,或者gdb可能不支持windows平台。我的 g++ 和 gdb 版本是 8.1.0。我尝试了一些旧版本,但所有这些都有相同的问题。有什么好的解决办法,还是直接放弃?
【问题讨论】:
-
错误码0xc0000005表示访问冲突
标签: c++ visual-studio-code gdb mingw