Does anyone developing Bitcoin Core use VSCode for compilation and debugging on Linux/Ubuntu?
How can one configure VSCode to compile Bitcoin Core?
Does anyone developing Bitcoin Core use VSCode for compilation and debugging on Linux/Ubuntu?
How can one configure VSCode to compile Bitcoin Core?
I found a solution to work with VSCode, and use it for compilation.
.vscode
in the root of bitcoin repository folder.vscode/c_cpp_properties.json
file. This file contains the configuration for the C/C++ project, including compiler type and source path..vscode/tasks.json
file. This file contains configuration for build and test tasks, which compiles the code and parses errors into the IDECtrl+Shift+B
to run the build taskIf you want to develop on a Windows machine but build and run on a remote Linux machine, this can be done with the Remote Development extension. After connecting to the remote server, create the relevant files in the directory.
The relevant json files:
c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${default}",
"${workspaceFolder}/src"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64",
"browse": {
"path": [
"${workspaceFolder}/src"
],
"limitSymbolsToIncludedHeaders": false,
"databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db"
}
}
],
"version": 4
}
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",
"type": "shell",
"command": "make -j 8",
"problemMatcher": {
"base": "$gcc",
"fileLocation": ["relative", "${workspaceFolder}/src"]
},
"options": {
"cwd": "${workspaceFolder}"
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Test",
"type": "shell",
"command": "make check",
"problemMatcher": {
"base": "$gcc",
"fileLocation": ["relative", "${workspaceFolder}/src"]
},
"options": {
"cwd": "${workspaceFolder}"
},
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "Clean",
"type": "shell",
"command": "make clean",
"problemMatcher": {
"base": "$gcc",
"fileLocation": ["relative", "${workspaceFolder}/src"]
},
"options": {
"cwd": "${workspaceFolder}"
},
},
]
}