简体   繁体   English

在 Windows 上调试 C++

[英]Debugging C++ on Windows

I'm trying to implement a Suffix Trie to search strings using C++ for a programming assignment.我正在尝试实现一个后缀树来搜索字符串,使用 C++ 进行编程分配。 Now I've started coding things with Vim/Ubuntu on a virtual machine (since I run windows), partly because it's encouraged by our lecturer not to use IDEs and compile things manually, and partly because the VM is too slow to run a decent IDE anyway.现在我已经开始在虚拟机上使用 Vim/Ubuntu 编写代码(因为我运行的是 Windows),部分原因是我们的讲师鼓励不要使用 IDE 并手动编译内容,部分原因是 VM 运行速度太慢而无法正常运行IDE无论如何。

But my program has grown quite large and I need to debug things.但是我的程序已经变得非常大,我需要调试一些东西。 I've grown quite fond of both Eclipse's and CLion's debuggers in the past, so I decided to copy and paste my workspace to a windows directory, just for debugging.过去,我非常喜欢 Eclipse 和 CLion 的调试器,因此我决定将我的工作区复制并粘贴到 Windows 目录中,仅用于调试。

I'm using C++11 and MinGW as a compiler, and programs run just fine:我使用 C++11 和 MinGW 作为编译器,程序运行得很好:

程序运行良好

But when I tried to debug the program, I got the message:但是当我尝试调试程序时,我收到了消息:

克莱恩

So I decided to try debugging in Eclipse instead.所以我决定尝试在 Eclipse 中调试。 This time it sort of worked, but it isn't treating my std::string objects as strings, but rather as just objects with lots of properties in them:这次它有点工作,但它没有将我的std::string对象视为字符串,而是将其视为具有许多属性的对象:

在此处输入图片说明 在此处输入图片说明

This is obviously a problem since I'm dealing a lot with std::string s.这显然是一个问题,因为我经常处理std::string Now I've read online that this is related to the whole pretty printers thing I got with CLion, but I haven't been able to find anything which tells me how to get things set up with MinGW.现在我在网上读到这与我使用 CLion 获得的整个漂亮的打印机有关,但是我找不到任何告诉我如何使用 MinGW 进行设置的信息。 I'd appreciate any advice.我很感激任何建议。

I was trying to figure out the same thing few days back.几天前我试图弄清楚同样的事情。 After Googling for hours and compiling all the stuff into one place, I have created a detailed post which might here.在谷歌搜索数小时并将所有内容编译到一个地方后,我创建了一篇详细的帖子,可能在这里。 Here is the link: https://dev.to/abhinav1602/how-to-run-vs-code-c-debugger-on-windows-4d3这是链接: https : //dev.to/abhinav1602/how-to-run-vs-code-c-debugger-on-windows-4d3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM