Vs_Code对c进行debug的时候遇到的一个问题以及解决方案

之前在vscode进行debug调试的时候就会发生这个问题,这个问题也是我找了几天百度也到现在才成功解决的

(图为网页随机找图截取,问题一样,我解决的时候已经没有这个提示了所也懒得改回来刻意截图了)

这个时候下面的终端也会有以下提示

Unable to start debugging. Program path '***.exe' is missing or invalid. GDB failed with message: "***.exe": not inexecutable format: File format not recognized This may occur if the process's executable was changed after the process was started, such as when installing an update. Try re-launching the application or restarting the machine.

遇到这个问题,就要去修改vscode下俩个json文件(task和launch)

先给出解决后的源代码:

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": "g++.exe - Build and debug active file",        //配置名称里cpp改为g++
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,            //推荐打开,这样输出结果会打印在cmd窗口
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",        //注意一下调试器的路径,路径为gdb所在的位置
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file"        //cpp改为g++,与tasks.json的label相对应
        }
    ]
}

Task.json

{
    "tasks": [
        {
            "type": "shell",
            "label": "C/C++: g++.exe build active file",        //cpp改为g++,任务名称,与launch.json的preLaunchTask相对应
            "command": "g++.exe",                            // 要使用的编译器,建议使用g++
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
    ],
    "version": "2.0.0"
}

 

参考链接:

https://blog.csdn.net/weixin_44578662/article/details/107768618

  • 7
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
在部署meteor时,npm install出错的问题可能是由于缺少bcrypt@3.0.8造成的。具体的错误信息如下所示: ``` npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! bcrypt@3.0.8 install: `node-pre-gyp install --fallback-to-build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the bcrypt@3.0.8 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\lenovo\AppData\Roaming\npm-cache\_logs\2022-01-03T01_39_35_248Z-debug.log ``` 为了解决这个问题,你可以尝试以下解决方案: 引用建议你查找生成项目的npm版本,并在服务器上安装相同版本的npm。你可以通过运行以下命令来找到npm的版本号: ``` npm -v ``` 然后使用以下命令来安装特定版本的npm: ``` npm install -g npm@版本号 ``` 另外,引用指出在部署时可能会遇到版本问题,所以确保部署环境与原项目环境一致,不要使用最新的node.js和npm版本。 关于你提到的日志文件的路径[C:\Users\zcc\AppData\Local\npm-cache\_logs\2023-09-02T00_32_09_033Z-debug-0.log],这是npm运行过程中生成的完整日志文件,你可以查看这个文件来获取更多关于出错的详细信息。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [npm ERR 部署meteor时npm install出错问题解决](https://blog.csdn.net/a1511954497/article/details/122284104)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值