• Mac-VScode


    1) 安装 xcode。

    打开App Store,搜索xcode,进行下载安装。

    2)执行命令:

    xcode-select --install

    3)安装VS Code

    https://code.visualstudio.com/

    4) 打开vs code。打开左侧扩展栏,安装c++扩展

    5)c_cpp_properties.json文件

    {
        "configurations": [
            {
                "name": "Mac",
                "includePath": [
                    "${workspaceFolder}/**",
                    "/Library/Developer/CommandLineTools/usr/include/c++/v1",
                "/usr/local/include",
                "/Library/Developer/CommandLineTools/usr/lib/clang/9.0.0/include",
                "/Library/Developer/CommandLineTools/usr/include",
                "/usr/include"
                ],
                "defines": [],
                "macFrameworkPath": [
                    "/System/Library/Frameworks",
                    "/Library/Frameworks"
                ],
                "compilerPath": "/usr/bin/clang",
                "cStandard": "c11",
                "cppStandard": "c++17",
                "intelliSenseMode": "clang-x64"
            }
        ],
        "version": 4
    }

    6)配置task.json

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "label": "c++",
                "command": "clang++",
                "type": "shell",
                "args": [
                    "./c++/hello.cpp",//根据需要修改
                    "-std=c++11",
                    "-g"
                ],
                "presentation": {
                    "echo": true,
                    "reveal": "always",
                    "focus": false,
                    "panel": "shared"
                }
            }
        ]
    }

    7)配置launch.json

    {
        // 使用 IntelliSense 了解相关属性。 
        // 悬停以查看现有属性的描述。
        // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "name": "c/c++ Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/a.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "lldb",
            "preLaunchTask":"c++"
            }
        ]
    }

    8)开启调试

    参考:https://www.cnblogs.com/xuanhun/p/9890931.html

  • 相关阅读:
    HTTP协议(三)之缓存
    第三方开源库MBProgressHUD的功能扩展
    CocoaPods pod install/pod update更新慢的问题
    项目总结Version 1.0(三)
    项目总结Version 1.0(二)
    iOS内存管理nonatomic,assign,copy,retain
    Mac升级到Yosemite后默认的php版本不支持imagetfftext函数问题解决
    3333333333333333
    11111111111111111111
    ssssssssssssssss
  • 原文地址:https://www.cnblogs.com/yrm1160029237/p/11787765.html
Copyright © 2020-2023  润新知