VSCode环境配置(QT)
1.VSCode环境配置(QT)
2.Log4cplus导入QT5(VSCode)3.不显示命令提示符窗口(CMake)4.LVDS(FPGA)5.更新QT Creator 14后launch debugger报错6.VSCode配置Python(记录)7.QT打包exe(含错误解决方法)8.Vivado联合Modelsim仿真9.C++静态变量10.解决Vivado连接不到硬件的报错11.vivado系统任务学习12.QT打开一直转圈13.QT导入Eigen库14.错误记录:Poor placement for routing between an IO pin and BUFG.15.错误记录:[Synth 8-6895] The reference checkpoint16.VSCode中CMake tools插件配置文件17.QT添加外部库(CMake Mingw)18.错误记录:[Place 30-681] Sub-optimal placement for a global clock-capable IO pin and MMCM pair.Visual Studio Code
1.QT安装
-
系统:win10
-
安装准备:官网下载qt-online-installer-windows-x64.exe在线安装程序
-
QT账户申请个人免费版
-
选择版本:勾选Archive并筛选
- 选择对应组件
若是自己下载MinGW,需要使用posix版本,实测5.3、7.3和8.1posix版本均可使用,为了保持一致性,最好使用8.1版本
- 环境变量添加
若环境变量过长超过Windows预设长度可参考以下文章:
https://blog.csdn.net/mzl_18353516147/article/details/130387147 新建公共路径前缀or引入新的拓展环境变量
- 重启
环境变量设置可能不生效,建议重启电脑
2.插件安装
- CMake相关
- QT相关
- C++相关
3.Json配置
- CMake图形化配置
CMake侧边栏-->配置-->可选择对应工具包,这里选择GCC 8.1.0
若是系统环境较为混乱可以打开cmake-tools-kits.json文件(该文件位于user目录下,可以选择使用Everything软件进行系统检索),提前备份一份,再将cmake-tools-kits.json打开,将其中相关内容删去重新扫描工具包,此时会自动更新json文件
- 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", } ] }
本文作者:Little_R
本文链接:https://www.cnblogs.com/Little-Rainbow/p/18337507
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步