采用基于QT creater方式实现:
1. Qt Creator——创建项目——Qt Widgets Application——CMake——Desktop Qt 6.8.0 MSVC2022 64bit——接下来全默认
关键点是选择CMake和构建套件这里用windows的MSVC。
2. 用vscode打开,即可。
可以配置一个调试任务,通过launch.json
{"configurations": [{"name": "Debug","type": "cppvsdbg","request": "launch","program": "${workspaceRoot}/build/18_hostviewer.exe","args": [],"stopAtEntry": false,"cwd": "${workspaceRoot}","environment": [{"name": "Path","value": "${env:Path}"}],"console": "integratedTerminal","visualizerFile": "c:\\Users\\28581_000\\AppData\\Roaming\\Code\\User\\workspaceStorage\\82374bd0d6964042862d0dab26adef68\\tonka3000.qtvsctools\\qt.natvis.xml"}]
}
在vscode 中直接编译就可以了。要注意,vscode中要先安装相关C/C++ 和CMAKE的拓展。