如何使用Intel C/C++ VSCODE调试器中的经典编译器?

发布于 2025-01-30 09:06:10 字数 436 浏览 5 评论 0原文

我正在Mac上设置C环境,以实现我的博士学位数值代码。 我正在使用Intel C/C ++经典编译器,而不是默认的clang。

到目前为止,我设法生成了一些调试信息,引起命令,例如ICC -STD = C17 -O代码-G code.c code.c

当我调用run and debug选项时,在VSCODE中,它向我显示2个选项:C ++(GDB/LLDB)C ++(Windows)。当我单击第一个时,它显示了2个选项:c/c ++:clang build and debug活动文件c/c ++:GCC构建和debug活动文件。它没有显示与英特尔经典编译器有关的任何内容。如何使用此编译器在VSCODE环境中使用Intel C ++经典编译器进行调试?

提前致谢!

I'm setting up a C environment on a Mac to implement some numerical codes for my phd.
I'm using the Intel C/C++ Classic compiler instead of the default clang.

So far, I manage to generate some debugging information evoking a command like icc -std=c17 -o code -g code.c

When I call the Run and Debug option in VSCode it show 2 options to me: C++(GDB/LLDB) and C++ (Windows). When I click the first one it shows 2 more options: C/C++: clang build and debug active file or C/C++: gcc build and debug active file. It does not show anything related to the Intel Classic Compiler. How do I use this compiler to debug with Intel C/C++ Classic compiler inside the VSCode environment?

Thanks in advance!

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

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

发布评论

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

评论(1

北恋 2025-02-06 09:06:10

根据 documentation 选择,您选择了,我认为您认为您正在混合编译和调试。 C/C ++:从系统上检测到的编译器列表中的GCC构建和调试活动文件只是帮助您生成这样的配置:

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "shell",
      "label": "C/C++: g++ build active file",
      "command": "/usr/bin/g++",
      "args": ["-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}"],
      "options": {
        "cwd": "/usr/bin"
      },
      "problemMatcher": ["$gcc"],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "detail": "Task generated by Debugger."
    }
  ]
}

如果您想在VSCODE中调试,则需要做什么只是将此配置添加到您的启动.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/code",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

I think you are mixing compiling and debugging up, according to the documentation, choosing C/C++: gcc build and debug active file from the list of detected compilers on your system is just helping you to generate some configuration like this:

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "shell",
      "label": "C/C++: g++ build active file",
      "command": "/usr/bin/g++",
      "args": ["-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}"],
      "options": {
        "cwd": "/usr/bin"
      },
      "problemMatcher": ["$gcc"],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "detail": "Task generated by Debugger."
    }
  ]
}

If you want to debug in VSCode, what you need to do is simply adding this configuration to your launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/code",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文