赞
踩
vscode代码编辑器有自己一些优势,考虑用它开发qt6项目:
整个配置过程如下:
qt creator 创建一个测试工程,当然,工程是cmake类型 :
vsocode 打开cmakeLists.txt文件,回自动构建项目。
按crtl+shift+p 输入cmake,点击Select a Kit
选择编译器:
构建:
结果 :到输出文件夹下运行exe文件:
我遇到的问题,过往我装过多个环境等,但打开cmake,选择不到我的kit,还是原来的东西,曾想直接覆盖目录内容,但编译都无法启动了。
解决办法如下:
先删除如下文件:
原文件内容为:
- [
- {
- "name": "GCC 8.1.0 x86_64-w64-mingw32",
- "compilers": {
- "C": "D:\\tools\\mingw64\\bin\\gcc.exe",
- "CXX": "D:\\tools\\mingw64\\bin\\g++.exe"
- },
- "isTrusted": true,
- "environmentVariables": {
- "CMT_MINGW_PATH": "D:\\tools\\mingw64\\bin"
- },
- "preferredGenerator": {
- "name": "MinGW Makefiles"
- }
- },
- {
- "name": "Visual Studio Community 2022 Release - amd64",
- "visualStudio": "ed7b1979",
- "visualStudioArchitecture": "x64",
- "isTrusted": true,
- "preferredGenerator": {
- "name": "Visual Studio 17 2022",
- "platform": "x64",
- "toolset": "host=x64"
- }
- },
- {
- "name": "Visual Studio Community 2022 Release - amd64_x86",
- "visualStudio": "ed7b1979",
- "visualStudioArchitecture": "x64",
- "isTrusted": true,
- "preferredGenerator": {
- "name": "Visual Studio 17 2022",
- "platform": "win32",
- "toolset": "host=x64"
- }
- },
- {
- "name": "Visual Studio Community 2022 Release - x86",
- "visualStudio": "ed7b1979",
- "visualStudioArchitecture": "x86",
- "isTrusted": true,
- "preferredGenerator": {
- "name": "Visual Studio 17 2022",
- "platform": "win32",
- "toolset": "host=x86"
- }
- },
- {
- "name": "Visual Studio Community 2022 Release - x86_amd64",
- "visualStudio": "ed7b1979",
- "visualStudioArchitecture": "x86",
- "isTrusted": true,
- "preferredGenerator": {
- "name": "Visual Studio 17 2022",
- "platform": "x64",
- "toolset": "host=x86"
- }
- },
- {
- "name": "Visual Studio 生成工具 2022 Release - amd64",
- "visualStudio": "0aeaf3ef",
- "visualStudioArchitecture": "x64",
- "isTrusted": true,
- "preferredGenerator": {
- "name": "Visual Studio 17 2022",
- "platform": "x64",
- "toolset": "host=x64"
- }
- },
- {
- "name": "Visual Studio 生成工具 2022 Release - amd64_x86",
- "visualStudio": "0aeaf3ef",
- "visualStudioArchitecture": "x64",
- "isTrusted": true,
- "preferredGenerator": {
- "name": "Visual Studio 17 2022",
- "platform": "win32",
- "toolset": "host=x64"
- }
- },
- {
- "name": "Visual Studio 生成工具 2022 Release - x86",
- "visualStudio": "0aeaf3ef",
- "visualStudioArchitecture": "x86",
- "isTrusted": true,
- "preferredGenerator": {
- "name": "Visual Studio 17 2022",
- "platform": "win32",
- "toolset": "host=x86"
- }
- },
- {
- "name": "Visual Studio 生成工具 2022 Release - x86_amd64",
- "visualStudio": "0aeaf3ef",
- "visualStudioArchitecture": "x86",
- "isTrusted": true,
- "preferredGenerator": {
- "name": "Visual Studio 17 2022",
- "platform": "x64",
- "toolset": "host=x86"
- }
- }
- ]

再重新打开vscode,出现了我环境变量中配置的项目:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。