Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Build configuration: cannot execute an Qt's example in MS Studio Code
Forum Update on Monday, May 27th 2025

Build configuration: cannot execute an Qt's example in MS Studio Code

Scheduled Pinned Locked Moved Solved Installation and Deployment
4 Posts 2 Posters 435 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ArantxaES
    wrote on 4 Oct 2024, 20:18 last edited by ArantxaES 10 Apr 2024, 20:22
    #1

    Hi everybody,
    How do you configure the Build (Qt + CMake) in your beloved IDE's (MSVC) Workspace?
    This tutorial on the internet didn't help me, because I'm using an OS different from Windows OS.
    So here are the hard facts:

    • OS: Ubuntu 24.0.1 (brand-new!)
    • Qt: Creator 6.7.3
    • Compiler: gcc/g++ 13.2
    • IDE: MS Visual Studio Code (from snap)
    • Extensions installed in MVSC: ms-vscode.cpptools, twxs.cmake, ms-vscode.cmake-tools, theqtcompany.qt, theqtcompany.qt-cpp-pack and tonka3000.qtvsctools
    • Qt's installation folder: home/Qt/
    • Qt example's folder: home/Qt/Examples/Qt-6.7.3/widgets/widgets/calculator/

    How I defined my workspace
    I defined as Workspace the Qt's installation folder altogether with the Qt's example folder, just to be sure that the header and source files would be also considered.
    MSVC automatically created a "blended configuration folder" called ".vscode". There are under "calculator" Folder, for example, two JSON-Files: "c_cpp_properties.json" and "tasks.json". Under "Qt" folder just one: "settings.json".

    What happens when I open the calculator.cpp file
    There is these notification:
    Bad CMake executable: "". Check to make sure it is installed or the value of the "cmake.cmakePath" setting contains the correct path

    How are the MSVC Settings*
    At "MSVC Settings -> Extensions -> CMake Tools -> Cmake Path" is setted as "cmake".
    In my Linux Terminal I got this information:

    whereis cmake
    cmake: /usr/share/cmake
    

    And what's in inside:

    /usr/share/cmake/bash-completion$ ls
    bash-completion-config.cmake  bash-completion-config-version.cmake
    

    But when I change it on "MSVC Settings -> Extensions -> CMake Tools -> Cmake Path"* I get the real-time notification:
    Executing command: /usr/share/cmake --version
    [proc] The command: /usr/share/cmake --version failed with error: Error: spawn /usr/share/cmake EACCES/ENOENT

    Then I installed by snap the CMake, but that's totally confusing... shouldn't the MSVC's Extension for CMakeTools make it easier? My stand-alone Qt Creator worked, but I'm guessing that they used qmake instead of cmake.

    So I left the field as: /snap/bin/cmake

    But the notification is still the same! :(

    C 1 Reply Last reply 4 Oct 2024, 20:23
    0
    • A ArantxaES
      4 Oct 2024, 20:18

      Hi everybody,
      How do you configure the Build (Qt + CMake) in your beloved IDE's (MSVC) Workspace?
      This tutorial on the internet didn't help me, because I'm using an OS different from Windows OS.
      So here are the hard facts:

      • OS: Ubuntu 24.0.1 (brand-new!)
      • Qt: Creator 6.7.3
      • Compiler: gcc/g++ 13.2
      • IDE: MS Visual Studio Code (from snap)
      • Extensions installed in MVSC: ms-vscode.cpptools, twxs.cmake, ms-vscode.cmake-tools, theqtcompany.qt, theqtcompany.qt-cpp-pack and tonka3000.qtvsctools
      • Qt's installation folder: home/Qt/
      • Qt example's folder: home/Qt/Examples/Qt-6.7.3/widgets/widgets/calculator/

      How I defined my workspace
      I defined as Workspace the Qt's installation folder altogether with the Qt's example folder, just to be sure that the header and source files would be also considered.
      MSVC automatically created a "blended configuration folder" called ".vscode". There are under "calculator" Folder, for example, two JSON-Files: "c_cpp_properties.json" and "tasks.json". Under "Qt" folder just one: "settings.json".

      What happens when I open the calculator.cpp file
      There is these notification:
      Bad CMake executable: "". Check to make sure it is installed or the value of the "cmake.cmakePath" setting contains the correct path

      How are the MSVC Settings*
      At "MSVC Settings -> Extensions -> CMake Tools -> Cmake Path" is setted as "cmake".
      In my Linux Terminal I got this information:

      whereis cmake
      cmake: /usr/share/cmake
      

      And what's in inside:

      /usr/share/cmake/bash-completion$ ls
      bash-completion-config.cmake  bash-completion-config-version.cmake
      

      But when I change it on "MSVC Settings -> Extensions -> CMake Tools -> Cmake Path"* I get the real-time notification:
      Executing command: /usr/share/cmake --version
      [proc] The command: /usr/share/cmake --version failed with error: Error: spawn /usr/share/cmake EACCES/ENOENT

      Then I installed by snap the CMake, but that's totally confusing... shouldn't the MSVC's Extension for CMakeTools make it easier? My stand-alone Qt Creator worked, but I'm guessing that they used qmake instead of cmake.

      So I left the field as: /snap/bin/cmake

      But the notification is still the same! :(

      C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 4 Oct 2024, 20:23 last edited by
      #2

      @ArantxaES said in Build configuration: cannot execute an Qt's example in MS Studio Code:

      whereis cmake
      cmake: /usr/share/cmake

      I don't know what/why whereis is looking for a directory but you must point it to the cmake executable, most likely in /usr/bin/ (or you forgot to install it).

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ArantxaES
        wrote on 4 Oct 2024, 20:31 last edited by ArantxaES 10 Apr 2024, 20:37
        #3

        Hallo Christian,
        The error remains after some trials:
        /snap/bin/cmake
        /snap/bin/
        /snap/bin

        arantxa@ARANTXA-R2D2:~$ /snap/bin/cmake --version
        cmake version 3.30.4
        
        1 Reply Last reply
        0
        • A Offline
          A Offline
          ArantxaES
          wrote on 5 Oct 2024, 14:14 last edited by
          #4

          I was able to resolve replacing "/snap/bin/cmake" for:
          cmake.cmakePath = /snap/cmake/current/bin/cmake

          1 Reply Last reply
          0
          • A ArantxaES has marked this topic as solved on 5 Oct 2024, 14:14

          1/4

          4 Oct 2024, 20:18

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved