Better_Software_Header_MobileBetter_Software_Header_Web

Find what you need - explore our website and developer resources

VS Code for Qt Applications - Part 2

A Technical Guide

{
  "label": "Create build dir",
  "type": "shell",
  "command": "mkdir -Force path/to/build/dir"
}
{
  "label": "Run qmake",
  "type": "shell",
  "command": "qmake",
  "arg": [ ... add your qmake arguments here ... ],
  "options": {
    "cwd": "path/to/build/dir"
  }
}
{
  "label": "Run make",
  "type": "shell",
  "command": "jom",
  "options": {
    "cwd": "path/to/build/dir"
  }
}
{
  "label": "Clear build folder",
  "type": "shell",
  "command": "jom clean",
  "options": {
    "cwd": "path/to/build/dir"
  }
}
{
  "label": "Build",
  "dependsOn": [
    "Create build dir",
    "Run qmake",
    "Run make"
  ],
  "dependsOrder": "sequence"
}
{
  "label": "Clean build",
  "dependsOn": [
    "Clear build folder",
    "Create build dir",
    "Run qmake",
    "Run make"
  ],
  "dependsOrder": "sequence"
}
{
  // ... task configuration
  "group": {
    "kind": "build",
    "isDefault": true
  }
}
{
  // All other settings...
  "terminal.integrated.env.windows": {
    "PATH": "C:/Qt/5.12.4/msvc2017_64/bin;${env:PATH}"
  }
}
"cmake.configureSettings": {
  "CMAKE_PREFIX_PATH": "my/prefix/path",
  "ENABLE_FEATURE": "1",
  "ENABLE_OTHER_FEATURE": "0"
}
"cmake.buildDirectory": "${workspaceFolder}/../build-cmake-project"
"cmake.configureSettings": {
  "CMAKE_PREFIX_PATH": "otherprefixpath;C:/Qt/5.12.4/msvc2017_64"
  // ... other args
]
{
  "name": "My application",
  "type": "cppvsdbg",
  "request": "launch",
  "program": "path/to/application",
  "stopAtEntry": false,
  "cwd": "${workspaceFolder}",
  "environment": [],
  "externalConsole": false
}
"environment": [
  {
    "name": "PATH",
    "value": "C:/Qt/5.12.4/msvc2017_64/bin;${env:PATH}"
  }
]
"symbolSearchPath": "otherSearchPath;C:/Qt/5.12.4/msvc2017_64/bin"
"sourceFileMap": {
    "C:/work/build/qt5_workdir/w/s": "C:/Qt/5.12.4/Src",
    "Q:/qt5_workdir/w/s": "C:/Qt/5.12.4/Src",
    "C:/Users/qt/work/install": "C:/Qt/5.12.4/Src",
    "C:/Users/qt/work/qt": "C:/Qt/5.12.4/Src"
}
"visualizerFile": "path/to/qt5.natvis"

Debug pane before and after configuring natvis

{
  // ...
  "includePath": [
    // ...
    "C:/Qt/5.12.4/msvc2017_64/include/**"
  ]
}
{
  "configurations": [
    {
      "name": "Win32",
      "intelliSenseMode": "msvc-x64",
      "configurationProvider": "vector-of-bool.cmake-tools"
    }
  ],
  "version": 4
}
"terminal.integrated.shellArgs.windows": [
  "Invoke-BatchFile 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Auxiliary/Build/vcvars64.bat' amd64",
  "; powershell"
]
powershell <terminal.integrated.shellargs.windows> -Command <task command> <task argument list>
powershell Invoke-BatchFile 'path/to/vcvars' ; powershell -Command <task command> <task argument list>

About KDAB


6 Comments

5 - Jun - 2020

Jacksiro

28 - Jul - 2020

Afshin

9 - Jan - 2023

Eddy

9 - Oct - 2023

RJM

12 - Oct - 2023

Alessandro Ambrosano

3 - Jun - 2024

SanthoshKumar

AlessandorAmbrosano

Alessandro Ambrosano

Senior Software Engineer

Learn Modern C++

Learn more