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":
}

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

Mac-VScode的更多相关文章

  1. 记录一次Mac VSCode运行Grpc模板项目

    1.使用dotnet new grpc -o GrpcGreeter && cd GrpcGreeter && code . ,进入项目文件中,使用code .使用vs ...

  2. mac vscode 实用快捷键

    cmd+del:光标左边删到头 cmd+fn+del:光标右侧删到头

  3. Visual Studio Code 使用心得

    Visual Studio Code 使用心得 最好用的跨平台编辑器,没有之一! 修改编辑器的显示语言 起因:vsCode又升级了(1.13.0),重启之后发现熟悉的中文菜单没有了,而且设置文件 se ...

  4. .netCore数据库迁移

    程序包管理器控制台下Nuget 命令: 初始迁移命令: add-migration init -Context DAL.ProductContext 全称:migrations add Initial ...

  5. flutter安装中的一些方法

    1.配置flutter环境变量 进入终端 vim ~/.bash_profile export ANDROID_HOME=~Library/Android/sdk export PATH=$PATH: ...

  6. VS code开发工具的使用教程

    前言 工欲善其事必先利其器,提高程序员的开发效率必须要有一个好的开发工具,当前最好的前端开发工具主要有VS code.sublime Text.Atom.Webstorm.Notepad++. VS ...

  7. 2016年最新mac下vscode配置golang开发环境支持debug

    网上目前还找不到完整的mac下golang环境配置支持,本人配置成功,现在整理分享出来. mac最好装下xcode,好像有依赖关系安装Homebrew打开终端窗口, 粘贴脚本执行/usr/bin/ru ...

  8. 【翻译】在Mac上使用VSCode创建你的第一个Asp.Net Core应用

    Setting Up Your Development Environment 设置你的开发环境 To setup your development machine download and inst ...

  9. Mac OS中使用VScode配置C语言开发环境

    个人博客 chinazt.cc 闲话少叙,直奔主题 下载VSCode https://code.visualstudio.com/download 安装C/C++插件 需要两个插件: 1. cppto ...

  10. Mac环境下使用VSCode搭建Go开发环境

    换新工作啦!!!开心一下.到了新公司一看,乖乖,全MAC办公,让我这只用过windows的土包子怎么活,而且公司的人都好高冷,于是自己摸索着搭建go语言开发环境了. go语言的ide挺多的,JetBr ...

随机推荐

  1. layer子窗口赋值给父窗口

    子窗体赋值给父窗体: parent.$('#Receiver').val(typearr); //关闭子弹窗 var index = parent.layer.getFrameIndex(window ...

  2. EasyUI 的日期控件单击文本框显示日历

    注意:可 用 ctrl+f 搜索 "_outerWidth():0" 1. jQuery.easyui.min.js1.3.2 版本   function _745(_746,_7 ...

  3. docker调用yum时“"/usr/libexec/urlgrabber-ext-down" is not installed”

    原因: 1 docker镜像为高版本的fedora30:latest镜像,yum本身已被dnf替代,但部分功能仍不完整: 如:yum-builddep SPECS/xxx.spec 解决办法: 1 安 ...

  4. boostrap中lg,md,sm,xs分别对应的像素宽度

    col-xs-   超小屏幕 手机 (<768px)col-sm-  小屏幕 平板 (≥768px)col-md-  中等屏幕 桌面显示器 (≥992px)col-lg-    大屏幕 大桌面显 ...

  5. HDU多校训练第一场 1012 Sequence

    题目链接:acm.hdu.edu.cn/showproblem.php?pid=6589 题意:给出一个长度为n的数组,有m次操作,操作有3种1,2,3,问操作m次后的数组,输出i*a[i]的异或和 ...

  6. Linux下安装git本地库与服务器端远程库

    1.    git是一个分布式版本管理系统,关于该工具的详细介绍,我认为廖雪峰老师介绍的非常全面:https://www.liaoxuefeng.com/wiki/896043488029600. 不 ...

  7. 【转】 linux下配置squid 服务器,最简单使用方式

    linux下配置squid 1.什么是squid Squid cache(简称为Squid)是一个流行的自由软件(GNU通用公共许可证)的代理服务器和Web缓存服务器.Squid有广泛的用途,从作为网 ...

  8. 2018-2-13-win10-uwp-HttpClient-post错误

    title author date CreateTime categories win10 uwp HttpClient post错误 lindexi 2018-2-13 17:23:3 +0800 ...

  9. org.apache.http.client.HttpClient使用方法

    一.org.apache.commons.httpclient和org.apache.http.client区别(转)   官网说明: http://hc.apache.org/httpclient- ...

  10. Motan框架初体验

    1.什么是Motan? Motan是一套基于java开发的RPC框架,除了常规的点对点调用外,motan还提供服务治理功能,包括服务节点的自动发现.摘除.高可用和负载均衡等.Motan具有良好的扩展性 ...