您如何在C+&#x2B中找到错误的行号。在VSCODE代码运行中?

发布于 2025-02-10 12:32:21 字数 141 浏览 0 评论 0原文

我是VSCODE的新手。我使用Code-Runner扩展程序来运行C ++程序,奇怪的是,它并没有确切告诉我哪一行引起了错误。我应该怎么知道?

例如,错误消息将看起来像这样

/bin/sh:行1:87002分割故障:11“/my/path”

I am pretty new to VSCode. I use code-runner extension to run C++ program and strangely it does not tell me exactly which line caused the error. How should I know it?

For example the error message will look like this

/bin/sh: line 1: 87002 Segmentation fault: 11 "/my/path"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深白境迁sunset 2025-02-17 12:32:21

我建议您从Visual Studio代码中选择选项终端>新终端并用类似的内容手动编译源文件:

c++ -Wall -Werror -Wextra -g -fsanitize=address <your_file_here.c>

如果有任何警告/错误/等,则汇编将失败。被编译器抓住。

I would suggest that you choose from Visual Studio Code the option Terminal > New Terminal and manually compile your source file with something similar to the following:

c++ -Wall -Werror -Wextra -g -fsanitize=address <your_file_here.c>

The compilation will fail if there is any warning/error/etc. caught by the compiler.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文