首页 > 其他分享 >VSC环境配置(QT)

VSC环境配置(QT)

时间:2024-08-01 21:19:04浏览次数:12  
标签:bin exe QT 配置 VSC 64 cpp Software

Visual Studio Code

1.QT安装

  1. 系统:win10

  2. 安装准备:官网下载qt-online-installer-windows-x64.exe在线安装程序

  3. QT账户申请个人免费版

  4. 选择版本:勾选Archive并筛选

  1. 选择对应组件

若是自己下载MinGW,需要使用posix版本,实测5.3、7.3和8.1posix版本均可使用,为了保持一致性,最好使用8.1版本

  1. 环境变量添加

若环境变量过长超过Windows预设长度可参考以下文章:

https://blog.csdn.net/mzl_18353516147/article/details/130387147 新建公共路径前缀or引入新的拓展环境变量

  1. 重启

环境变量设置可能不生效,建议重启电脑

2.插件安装

  1. CMake相关

  1. QT相关

  1. C++相关

3.Json配置

  1. CMake图形化配置

CMake侧边栏-->配置-->可选择对应工具包,这里选择GCC 8.1.0

若是系统环境较为混乱可以打开cmake-tools-kits.json文件(该文件位于user目录下,可以选择使用Everything软件进行系统检索),提前备份一份,再将cmake-tools-kits.json打开,将其中相关内容删去重新扫描工具包,此时会自动更新json文件

  1. sc文件夹下json配置
  • task.json

直接附上代码,修改command路径为QT对应位置即可

点击查看代码
{
    "tasks": [
        {
            "type": "shell",
            "label": "CMake Build",
            "command": "cmake",
            "args": [
                "--build",
                "${workspaceRoot}/build",
                "--config",
                "Debug"
            ],
            "group": "build",
            "problemMatcher": []
        },
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe 生成活动文件",
            "command": "D:/Software/QT/Tools/mingw810_64/bin/g++.exe",
            // "command": "D:\\Software\\Visual Studio Code2023\\MinGW\\x86_64-7.3.0-posix-sjlj\\mingw64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}
  • settings.json

同理,修改compilerPath和miDebuggerPath路径为QT对应位置即可

点击查看代码
{
    "cmake.generator": "MinGW Makefiles",
    "cmake.buildDirectory": "${workspaceFolder}/build",
    "qtConfigure.qtKitDir": "D:/Software/QT/5.15.2/mingw81_64",
    "files.associations": {
        "qmainwindow": "cpp",
        "iosfwd": "cpp",
        "*.ipp": "cpp",
        "any": "cpp",
        "array": "cpp",
        "atomic": "cpp",
        "*.tcc": "cpp",
        "cctype": "cpp",
        "chrono": "cpp",
        "clocale": "cpp",
        "cmath": "cpp",
        "codecvt": "cpp",
        "condition_variable": "cpp",
        "csignal": "cpp",
        "cstdarg": "cpp",
        "cstddef": "cpp",
        "cstdint": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cstring": "cpp",
        "ctime": "cpp",
        "cwchar": "cpp",
        "cwctype": "cpp",
        "deque": "cpp",
        "list": "cpp",
        "unordered_map": "cpp",
        "vector": "cpp",
        "exception": "cpp",
        "algorithm": "cpp",
        "functional": "cpp",
        "iterator": "cpp",
        "map": "cpp",
        "memory": "cpp",
        "memory_resource": "cpp",
        "numeric": "cpp",
        "optional": "cpp",
        "random": "cpp",
        "ratio": "cpp",
        "source_location": "cpp",
        "string": "cpp",
        "string_view": "cpp",
        "system_error": "cpp",
        "tuple": "cpp",
        "type_traits": "cpp",
        "utility": "cpp",
        "fstream": "cpp",
        "future": "cpp",
        "initializer_list": "cpp",
        "iomanip": "cpp",
        "iostream": "cpp",
        "istream": "cpp",
        "limits": "cpp",
        "mutex": "cpp",
        "new": "cpp",
        "ostream": "cpp",
        "sstream": "cpp",
        "stdexcept": "cpp",
        "streambuf": "cpp",
        "thread": "cpp",
        "cinttypes": "cpp",
        "typeinfo": "cpp",
        "variant": "cpp",
        "qpointf": "cpp",
        "bit": "cpp",
        "charconv": "cpp",
        "compare": "cpp",
        "concepts": "cpp",
        "coroutine": "cpp",
        "resumable": "cpp",
        "format": "cpp",
        "forward_list": "cpp",
        "ios": "cpp",
        "locale": "cpp",
        "queue": "cpp",
        "stop_token": "cpp",
        "xfacet": "cpp",
        "xhash": "cpp",
        "xiosbase": "cpp",
        "xlocale": "cpp",
        "xlocbuf": "cpp",
        "xlocinfo": "cpp",
        "xlocmes": "cpp",
        "xlocmon": "cpp",
        "xlocnum": "cpp",
        "xloctime": "cpp",
        "xmemory": "cpp",
        "xstddef": "cpp",
        "xstring": "cpp",
        "xtr1common": "cpp",
        "xtree": "cpp",
        "xutility": "cpp",
        "qapplication": "cpp"
    },
    "C_Cpp.default.compilerPath": "D:/Software/QT/Tools/mingw810_64/bin/g++.exe",
    "cmake.debugConfig": {
        "miDebuggerPath": "D:/Software/QT/Tools/mingw810_64/bin/gdb.exe"
    },
    "cmake.ignoreKitEnv": true,
}
  • launch.json

同理,修改value和DebuggerPath路径为QT对应位置即可

点击查看代码
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Qt_debug",
            "type": "cppdbg",
            "request": "launch",
            "program": "${command:cmake.launchTargetPath}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "environment": [
                {
                    "name": "PATH",
                    "value": "D:/Software/QT/5.15.2/mingw81_64/bin"
                }
            ],
            "externalConsole": false,
            "miDebuggerPath": "D:/Software/QT/Tools/mingw810_64/bin/gdb.exe",
        {
            "name": "test_debug",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/build/module/api/test.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "environment": [
                {
                    "name": "PATH",
                    "value": "D:/Software/QT/5.15.2/mingw81_64/bin"
                }
            ],
            "externalConsole": false,
            "miDebuggerPath": "D:/Software/QT/Tools/mingw810_64/bin/gdb.exe",
        }
    ]
}

标签:bin,exe,QT,配置,VSC,64,cpp,Software
From: https://www.cnblogs.com/Little-Rainbow/p/18337507

相关文章

  • Log4cplus导入QT5(VSCode)
    下载GitHub地址:https://github.com/log4cplus/log4cplus版本选择log4cplus-2.0.2编译环境搭建完成后即可CMake编译生成预编译库,可参考该项目README.md进行功能选择导入在实际工程CMakeLists.txt中导入头文件(库include目录),并链接预编译好的.dll文件到项目中运行及调试la......
  • 使用snapshot_download配置代理多线程下载模型
    snapshot_downloadhuggingface官方提供了snapshot_download方法下载完整模型,参数众多、比较完善。支持断点续传、多线程、指定路径、配置代理、排除特定文件等功能。然而有两个缺点:1))该方法依赖于transformers库,而这个库是个开发用的库,对于自动化运维有点重;2)该方法调用......
  • Jenkins 配置即代码(Configuration as Code)详解
    1、概述在《Centos7下安装配置最新版本Jenkins(2.452.3)》这篇博文中讲解了如何安装Jenkins,虽然在安装Jenkins时安装了一些必备的推荐插件,但在企业环境中使用Jenkins之前,我们仍需完成一系列手动配置工作,如配置SystemConfiguration、Security。SystemConfiguration是确保......
  • blutter 环境配置
    项目地址https://github.com/worawit/blutter需要安装最新的git,cmake,ninjagithttps://git-scm.com/download/wincmakehttps://github.com/Kitware/CMake/releases/download/v3.30.1/cmake-3.30.1-windows-x86_64.msininjahttps://github.com/ninja-build/ninja/rele......
  • 【Qt】QTextEdit
    QTextEdit是Qt中用于编辑和显示文本内容的类。其提供了丰富的用户界面控件,可以用于创建和包含格式化文本、图片和链接的文本编辑器常用属性 属性说明markdown输入框内持有的内容。支持markdown格式,能自动的对markdown文本进行渲染成htmlhtml输入框持有的内容。可以支持大......
  • MQTT协议与中间件
    发布订阅模式:消费者(客户端)订阅服务器(作为代理Broker)上的主题,当有生产者(客户端)在主题中发布消息时,消费者可以收到。MQTT:基于发布订阅模式的轻量级通讯协议,可以以极少的代码和有限带宽,为连接远程设备提供实时可靠的消息服务。广泛应用于物联网,小型设备。MQTT传输的消息分为两......
  • 云计算19------前端服务器的配置以及tomcat环境的配置
    回顾[root@tomcat~]#cdeleme_web/public/img/[root@tomcatimg]#ls1.jpg[root@tomcatpublic]#cd[root@tomcat~]#cdeleme_web/[root@tomcateleme_web]#cdsrc[root@tomcatsrc]#vimviews/HomeView.vue [root@tomcatsrc]#nohupnpmrunserve  ctrl......
  • 本地同时配置github 和gitee 远程仓库
    在当下,gitee也成为国内很多开发人员交友社区。同时为了跟上时代的步伐,大家也不想放弃github。所以同时将自己的项目提交到gitee和github成了开发人员的诉求。git全局用户设置##产看全局配置gitconfig--global--list#清除(如果未添加过,则不需要清除)gitconfig--glo......
  • Frpc配置文件生成
    Frpc代理依赖Frpc.ini,本文介绍其配置操作1ini操作///<summary>///INI文件读写辅助类///</summary>internalstaticclassIniHelper{#regionPublicMethods///<summary>///写入INI文件///</summary>///<paramname=......
  • 为团队配置Linux环境,简单高效的项目共享方案
    前言最近好久没写博客了,事情太多了,我还搞了个新的好玩的项目,等后续做得差不多了来写篇文章介绍一下。在我们目前的AI项目中,团队需要共同使用一台GPU服务器来做模型训练和数据处理。为了让每个团队成员都能高效地使用这台服务器,我们决定设置一个多用户共享环境。这样,无论是代码开......