Giter Club home page Giter Club logo

vscodeqtcmakedemo's Introduction

CMake-based Qt project in VSCode

This demo shows how to code and debug CMake-based Qt application in VSCode. It's actually quite simple.

Before compiling & running this demo, something should be configures:

  1. Set system environmental variable Qt5_DIR to be the absolute path of your Qt installation.
  2. Install VSCode and relating extensions:
    1. CMake Tools
    2. C/C++ (It might be installed by default).

What I did including the following things:

  1. Configure the global includePath of VSCode to support intelligence of Qt classes. This is done by configuring the VSCode's global setting file: settings.json by adding things below:

    "[cpp]": {
        "editor.quickSuggestions": true
    },
    "[c]": {
        "editor.quickSuggestions": true
    },
    "C_Cpp.default.includePath": [
        "${env:Qt5_DIR}/include",
        "${workspaceFolder}/src"
    ],
  2. Configure the launch parameter of the project. This is done by editing the launch.json of the project:

    "program": "${command:cmake.launchTargetPath}",
    "environment": [
        {"name": "Path", "value": "${env:Path};${env:Qt5_DIR}/bin"}
    ],

    ${command:cmake.launchTargetPath} will be evaluated to return the path of your CMake target. It avoids hard-coding the executable path. And environment adds the Qt's bin folder to the application's running path.

vscodeqtcmakedemo's People

Contributors

cjmdaixi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.