I have the same issue but now with Qt6.
OS: Ubuntu 24.0.1
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/
I'm trying to run this example using CMakeLists.txt and c_cpp_properties.json.
c_cpp_properties.json in .vscode:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/home/arantxa/Qt/6.7.3/gcc_64/include/**",
"/home/arantxa/Qt/6.7.3/gcc_64/include/QtWidgets/"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
The top-level CMakeLists.txt:
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(calculator LANGUAGES CXX)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_standard_project_setup()
qt_add_executable(calculator
button.cpp button.h
calculator.cpp calculator.h
main.cpp
)
set_target_properties(calculator PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(calculator PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Widgets
)
install(TARGETS calculator
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
qt_generate_deploy_app_script(
TARGET calculator
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
Everything that is required, every include, is listed! I'm not sure what should I do.