关于解决:VSC无法将make项识别为cmdlet、函数、脚本文件或可运行程序的名称

1 篇文章 0 订阅
1 篇文章 0 订阅

之前提问过关于MinGW配置好后,VSC出现如下报错的问题:
在这里插入图片描述
后面我重新查了一些资料,看了一些文章,从配置环境的四个文件出发做了修改解决了这个问题,具体代码如下:
c_cpp_properties.json

{
  "configurations": [
    {
      "name": "windows-gcc-x64",
      "intelliSenseMode": "windows-gcc-x64",
      "compilerPath": "D:\\mingw64GCC\\mingw64\\bin\\gcc.exe",
      "includePath": [
        "${workspaceFolder}/**",
        "${workspaceFolder}"
      ],
      "cppStandard": "c++17",
      "compilerArgs": [],
      "cStandard": "c11"
    }
  ],
  "version": 4
}

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "(gdb) Launch",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": true,
      "MIMode": "gdb",
      "miDebuggerPath": "D:\\mingw64GCC\\mingw64\\bin\\gdb.exe",
      "preLaunchTask": "g++",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    },
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "cwd": "d:\\1VS Projcct_cpp",
      "environment": [],
      "program": "d:\\1VS Projcct_cpp\\build\\Debug\\outDebug",
      "internalConsoleOptions": "openOnSessionStart",
      "MIMode": "gdb",
      "miDebuggerPath": "D:\\mingw64GCC\\mingw64\\bin\\gdb.exe",
      "externalConsole": false
    }
  ]
}

settings.json

{
  "C_Cpp_Runner.warnings": [],
  "C_Cpp_Runner.compilerArgs": [],
  "C_Cpp_Runner.includePaths": [
    "${workspaceFolder}"
  ],
  "C_Cpp_Runner.linkerArgs": [],
  "C_Cpp_Runner.cppStandard": "c++17",
  "C_Cpp_Runner.excludeSearch": [],
  "C_Cpp_Runner.enableWarnings": true,
  "C_Cpp_Runner.warningsAsError": false,
  "C_Cpp_Runner.debuggerPath": "D:\\mingw64GCC\\mingw64\\bin\\gdb.exe",
  "C_Cpp_Runner.cCompilerPath": "D:\\mingw64GCC\\mingw64\\bin\\gcc.exe",
  "C_Cpp.default.compilerPath": "c:/Users/Zurich Yang/.vscode/extensions/bartmanabyss.amiga-debug-1.0.0/bin/opt/bin/m68k-amiga-elf-gcc.exe",
  "C_Cpp_Runner.cppCompilerPath": "D:\\mingw64GCC\\mingw64\\bin\\g++.exe",
  "C_Cpp_Runner.makePath": "D:\\mingw64GCC\\mingw64\\bin\\make.exe",
  "C_Cpp_Runner.cStandard": "c11"
}

tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558 
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "g++", //这里注意一下,见下文
            "command": "D:\\mingw64GCC\\mingw64\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "-ggdb3",   // 生成和调试有关的信息
                "-Wall",    // 开启额外警告
                "-static-libgcc",   // 静态链接
                "-std=c++17",       // 使用c++17标准
                "-finput-charset=UTF-8",    //输入编译器文本编码 默认为UTF-8
                "-fexec-charset=GB18030",   //输出exe文件的编码
                "-D _USE_MATH_DEFINES"
            ],
            "options": {
                "cwd": "D:\\mingw64GCC\\mingw64\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "presentation": {
                "echo": true,
                "reveal": "always", // 在“终端”中显示编译信息的策略,可以为always,silent,never
                 "focus": false,
                 "panel": "shared" // 不同的文件的编译信息共享一个终端面板
            },
        }
    ]
}


最后如果还有任何问题推荐去看一下这位up主的经验视频,连接如下:
【【小神仙讲 vscode教程】 十五分钟快速 win vscode C++ 环境搭建-哔哩哔哩】https://b23.tv/fVrqQr

  • 4
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这个错误提示说的是无法将“source”识别cmdlet函数脚本文件或可运行程序名称。根据提供的引用内容,看起来这可能是由于在某个命令中输入了错误的参数或者命令不存在导致的。你可以检查一下你输入的命令是否正确,或者尝试在命令行中执行这个命令看看是否能成功执行。如果问题仍然存在,建议你参考相关文档或者寻求更专业的技术支持来解决这个问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [ 无法将“source”识别cmdlet函数脚本文件或可运行程序名称】](https://blog.csdn.net/xiaochenXIHUA/article/details/130153956)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [关于解决VSC无法make识别cmdlet函数脚本文件或可运行程序名称](https://blog.csdn.net/m0_46808930/article/details/119807561)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值