簡體   English   中英

在 VSC 中不使用 a.out 進行調試

[英]Debugging without a.out in VSC

我想在 Visual Studio Code 中調試我的代碼。 但是,我錯過了a.out 我想我可能已經刪除了它。 我如何取回它? 沒有它有什么方法可以調試嗎? 我可以自己寫嗎?

我唯一想到的是將代碼復制粘貼到整個不同的文件夾中,制作新的 makefile 等。 這很乏味,我認為可能有更簡單的、超出我能力范圍的解決方案。

{
// 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}/a.out",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ]
    }
]
}

這是launch.js文件,我嘗試用Makefile之類的東西替換a.out ,因為它有一定的意義(好吧,我想到了,我鏈接了代碼,沒有任何可執行的方式)但沒有奏效。 我什至嘗試了可執行的 object obj (運行時./obj )但沒有。

謝謝。

a.out是編譯程序的默認文件名。 如果您在運行編譯器時沒有為 output 文件命名,則使用它。 在命令行上運行編譯器時,output 文件的名稱通常帶有-o選項。

聽起來您現在更改了一些設置,以便編譯的程序現在稱為“vector”而不是“a.out”。 所以只需更改調試器設置,使用“vector”而不是“a.out”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM