2019-07-26

mac+vscode+cmake 配置强大的c++开发环境

长期做c++服务器开发,以前一直使用Windows,习惯了vs操作,刚刚转到ma开发对于xcode用的各种不爽,打算配置vscode作为开发环境,折腾了一阵,记录一下.

环境配置过过程

安装c/c++插件

image.png

配置环境

一. lunch.json 调试环境

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="json" cid="n105" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); --select-text-bg-color: #36284e; --select-text-font-color: #fff; font-size: 0.9rem; line-height: 1.714285em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-size: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(218, 218, 218); position: relative !important; margin-bottom: 3em; margin-left: 2em; padding-left: 1ch; padding-right: 1ch; width: inherit; background-position: inherit inherit; background-repeat: inherit inherit;">{
// 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": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "{workspaceFolder}/build/BirkServer.out", "args": [], "stopAtEntry": false, "cwd": "{workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb",
"preLaunchTask": "Compile"
}
]
}</pre>

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" cid="n83" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); --select-text-bg-color: #36284e; --select-text-font-color: #fff; font-size: 0.9rem; line-height: 1.714285em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-size: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(218, 218, 218); position: relative !important; margin-bottom: 3em; margin-left: 2em; padding-left: 1ch; padding-right: 1ch; width: inherit; background-position: inherit inherit; background-repeat: inherit inherit;">{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/",
"/usr/local/include/
"
],
"defines": [],
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++11",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}</pre>

<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" cid="n111" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); --select-text-bg-color: #36284e; --select-text-font-color: #fff; font-size: 0.9rem; line-height: 1.714285em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-size: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(218, 218, 218); position: relative !important; margin-bottom: 3em; margin-left: 2em; padding-left: 1ch; padding-right: 1ch; width: inherit; background-position: inherit inherit; background-repeat: inherit inherit;">{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Compile",
"type": "shell",
"command": "cd ./build && cmake .. && make",
"args": [
],
"group": {
"kind": "build",
"isDefault": true
},
}
]
}</pre>

三. tasks.json 配置编译任务命令

二. c_cpp_properties.json c++ 智能提示,搜索路径

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 这篇文章的首要目的是,通过配置VSCode,达到全平台的一致C/C++开发体验。 对于编写C/C++的环境,我们至...
    Upppping阅读 59,156评论 18 30
  • 上半年公司开了新项目,更改了网络通信中数据结构,由json转化为了protobuf ,蓦然发现挺好用 近期项目即将...
    我看Android阅读 835评论 0 0
  • 目录结构 一.linux系统目录结构 Windows: 以多根的方式组织文件 C:\ D:\ E:\ F:Linu...
    昇昇不息阅读 163评论 0 0
  • linux系统目录结构 Windows:以多根的方式组织文件C:\ D:\ E:\ F:linux :...
    a幕城阅读 311评论 0 0
  • 这么快迎来倒数第二天,每次疲倦的时候都是没灵感写反思的,估计睡好觉非常重要。 今天谈谈游泳,有时候虽然知道理论,但...
    剽悍的大林阅读 165评论 0 0

友情链接更多精彩内容