Last active
July 5, 2019 11:45
-
-
Save xeptore/e2a32264e72005a1527bd17be0774ec2 to your computer and use it in GitHub Desktop.
cpp vscode development (cmake, build, and debugging) configurations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"configurations": [ | |
{ | |
"name": "Linux", | |
"includePath": [ | |
"${workspaceFolder}/**" | |
], | |
"defines": [ | |
"_DEBUG", | |
"UNICODE", | |
"_UNICODE" | |
], | |
"compilerPath": "/usr/bin/g++", | |
"cStandard": "c11", | |
"cppStandard": "c++17", | |
"intelliSenseMode": "gcc-x64", | |
"configurationProvider": "vector-of-bool.cmake-tools", | |
"compileCommands": "${workspaceFolder}/build/compile_commands.json" | |
} | |
], | |
"version": 4 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required (VERSION 3.10) | |
project (main) | |
# book.cpp implementing book.h definitions | |
add_library(Book book.h book.cpp) | |
add_executable(main main.cpp) | |
# linking Book library to main | |
target_link_libraries (main Book) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "build and debug", | |
"type": "cppdbg", | |
"request": "launch", | |
"program": "${fileDirname}/${fileBasenameNoExtension}", | |
"args": [], | |
"stopAtEntry": false, | |
"cwd": "${workspaceFolder}", | |
"environment": [], | |
"externalConsole": false, | |
"MIMode": "gdb", | |
"setupCommands": [ | |
{ | |
"description": "Enable pretty-printing for gdb", | |
"text": "-enable-pretty-printing", | |
"ignoreFailures": true | |
} | |
], | |
"preLaunchTask": "build", | |
"miDebuggerPath": "/usr/bin/gdb" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "build", | |
"type": "shell", | |
"command": "make", | |
"dependsOn": [ | |
"cmake" | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
} | |
}, | |
{ | |
"label": "cmake", | |
"type": "shell", | |
"command": "cmake", | |
"args": [ | |
"-DCMAKE_BUILD_TYPE=Debug", | |
"CMakeLists.txt" | |
], | |
"group": "build" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VSCode C++ Development Configuration
Using these configurations adds the ability to:
Usage
tasks.json
,launch.json
, andc_cpp_properties.json
files, into .vscode/ directory.CMakeLists.txt
file into your workspace directory.