Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@graykode
Last active July 15, 2019 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graykode/359abd55b3613176717d0b1238cad77b to your computer and use it in GitHub Desktop.
Save graykode/359abd55b3613176717d0b1238cad77b to your computer and use it in GitHub Desktop.
Mac OS vscode debugging

Install Xcode to use /Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi

{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"osx": {
"program": "${workspaceFolder}/a.out",
"MIMode": "lldb",
"miDebuggerPath": "/Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi"
},
"preLaunchTask": "build_c++",
"setupCommands": [
{
"text": "settings set target.input-path ${workspaceFolder}/input.txt"
}
]
}
]
}
1
2
3
4
5
6
7
8
9
10
5
# /Users/graykode/Library/Application Support/Code/User/settings.json
{
"window.zoomLevel": 0,
"editor.fontSize": 17,
"explorer.confirmDelete": false,
"C_Cpp.default.cStandard": "c11",
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.detectIndentation": false,
"editor.tabCompletion": "on",
"editor.formatOnType": true
}
// .vscode/tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build_c++",
"type": "shell",
"command": "g++",
"args": [
"-g",
"${file}",
"-o",
"a.out",
"&&",
"./a.out",
"<",
"${workspaceFolder}/input.txt",
">",
"${workspaceFolder}/output.txt"
],
"group": {
"kind": "build",
"isDefault": true
},
}
]
}
#include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> v;
for(int i=0; i<10; i++){
v.push_back(i);
}
int n; cin >> n;
for(int i=0; i<10; i++){
v.push_back(i);
cout << i + 1 << endl;
}
cout << n+1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment