Jetbrains fleet 配置 C++开发环境
1. 安装 Jetbrains Fleet
到Fleet下载页面下载Toolbox并安装
Jetbrains-Fleet下载页
安装完成后在任务栏打开 Toolbox ,在列表中选择安装 fleet。
2. 为 Fleet 准备 Workspace
在适当的地方建立文件夹作为 fleet 的工作空间,并在 fleet 中打开。
3. 配置 run.json 编译脚本
点击运行按钮,选择 Create Run Configuration
将其中内容配置如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| { "configurations": [ { "type": "command", "name": "CMake Build", "program": "cmake", "args": ["-DCMAKE_BUILD_TYPE=Debug","-G","MinGW Makefiles","-S", "$FILE_DIR$", "-B", "$FILE_DIR$\\cmake-build-debug"], }, { "type": "command", "name": "Make", "program": "mingw32-make", "args": ["-C","$FILE_DIR$\\cmake-build-debug"],
}, { "type": "command", "name": "Run", "program": "$FILE_DIR$\\cmake-build-debug\\$FILE_NAME_NO_EXT$.exe", }, { "type": "command", "name": "Build And Run", "program": "$FILE_DIR$\\cmake-build-debug\\$FILE_NAME_NO_EXT$.exe", "dependsOn": ["CMake Build", "Make"], }, { "type": "command", "name": "Example Build", "program": "g++", "args": ["$FILE$","-o","$FILE_DIR$\\$FILE_NAME_NO_EXT$.exe"] }, { "type": "command", "name": "Example Run", "program": "$FILE_DIR$\\$FILE_NAME_NO_EXT$.exe", }, { "type": "command", "name": "Example Build And Run", "program": "$FILE_DIR$\\$FILE_NAME_NO_EXT$.exe", "dependsOn": ["Example Build"], }, ] }
|
4. 安装 CMAKE 与MinGW-w64
CMAKE下载页面
MinGW-w64预编译二进制文件下载页面
CMAKE 直接安装即可,MinGW-w64 找个地方解压出来即可。
之后将 CMAKE 和 MinGW 的 bin 文件夹添加进系统 path 变量。
5. 运行配置如何使用
5.1 单个文件的编译运行
在工作空间下新建项目文件夹,在内部建立单个 cpp 文件并编写程序。
点击运行按钮,其中带 Example 前缀的是用于单个文件运行的配置:
- Example Build —— 编译该文件
- Example Run —— 不重新编译,运行上次编译的结果
- Example Build And Run —— 编译并运行当前文件
5.2 以 CMAKE 管理的项目的编译运行
在工作空间下新建项目文件夹,内部项目以 CMAKE 管理。
- CMakeLists.txt 中的项目名需要与作为 main 文件的文件名一致,例如主文件为
helloworld.cpp
,则 CMAKE 中的项目名应为helloworld
。
- 如果要使用 fleet 的 Smart Mode,CMakeLists.txt 中需要添加
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
生成编译数据库
点击运行按钮,其中不带 Example 前缀的是用于项目运行的配置:
- CMake Build —— 执行 CMAKE 项目构建,生成项目 Makefile 文件与编译数据库
- Make —— 编译项目
- Run —— 不重新编译,运行上次编译的结果
- Build And Run —— 编译项目并运行
{"created_time":"2022-12-13T12:17:53Z","files":[{"attachment_folder":"","created_time":"2022-12-13T12:17:53Z","id":"3","modified_time":"2022-12-13T12:57:12Z","name":"C-多线程开发.md","signature":"27205993786737","tags":[]},{"attachment_folder":"","created_time":"2022-12-13T12:17:53Z","id":"4","modified_time":"2022-12-13T13:01:21Z","name":"Git简明教程.md","signature":"113818304277873","tags":[]},{"attachment_folder":"","created_time":"2022-12-13T12:17:53Z","id":"5","modified_time":"2022-12-13T12:58:59Z","name":"PC下安卓拆包编译打包与重新签名.md","signature":"82331899030897","tags":[]},{"attachment_folder":"","created_time":"2022-12-13T12:17:53Z","id":"6","modified_time":"2022-12-13T13:00:34Z","name":"Windows11安装教程.md","signature":"67535736696177","tags":[]},{"attachment_folder":"","created_time":"2022-12-13T12:17:54Z","id":"7","modified_time":"2022-12-13T12:17:54Z","name":"更改开机引导LOGO(无需下载BIOS文件).md","signature":"49299305557362","tags":[]},{"attachment_folder":"","created_time":"2022-12-13T12:17:54Z","id":"8","modified_time":"2022-12-13T13:01:01Z","name":"机械键盘选购.md","signature":"126093320809842","tags":[]},{"attachment_folder":"","created_time":"2022-12-13T12:17:54Z","id":"9","modified_time":"2022-12-13T12:54:58Z","name":"漏洞扫描.md","signature":"115802579168626","tags":[]},{"attachment_folder":"","created_time":"2022-12-13T12:17:54Z","id":"10","modified_time":"2022-12-13T13:06:57Z","name":"网络编程(1).md","signature":"105073750863218","tags":[]},{"attachment_folder":"","created_time":"2022-12-13T12:17:54Z","id":"11","modified_time":"2022-12-13T12:17:54Z","name":"计算机协会社课01.md","signature":"24504459357554","tags":[]},{"attachment_folder":"","created_time":"2022-12-13T12:17:54Z","id":"12","modified_time":"2022-12-13T12:17:54Z","name":"计算机协会社课02.md","signature":"120883525479794","tags":[]},{"attachment_folder":"","created_time":"2022-12-26T07:56:52Z","id":"22","modified_time":"2022-12-26T07:59:51Z","name":"网络编程(2).md","signature":"177765700548","tags":[]},{"attachment_folder":"","created_time":"2022-12-26T07:59:24Z","id":"23","modified_time":"2022-12-26T08:00:38Z","name":"网络编程(3)基本服务端实现.md","signature":"79316833096796","tags":[]},{"attachment_folder":"","created_time":"2022-12-26T08:01:18Z","id":"24","modified_time":"2022-12-26T08:01:55Z","name":"网络编程(4)基本客户端实现.md","signature":"27205994894542","tags":[]},{"attachment_folder":"250420816240395","created_time":"2022-12-26T08:08:21Z","id":"25","modified_time":"2022-12-26T08:15:39Z","name":"SublimeText_CPP编译系统.md","signature":"113818305386101","tags":[]},{"attachment_folder":"","created_time":"2022-12-27T07:01:11Z","id":"26","modified_time":"2022-12-28T12:00:18Z","name":"VNote推送HEXO-Task.md","signature":"177765783607","tags":[]},{"attachment_folder":"","created_time":"2022-12-28T11:53:04Z","id":"27","modified_time":"2022-12-28T11:58:23Z","name":"SublimeText_JAVA编译系统.md","signature":"177765887520","tags":[]},{"attachment_folder":"","created_time":"2025-01-06T13:09:43Z","id":"28","modified_time":"2025-01-06T13:54:12Z","name":"jetbrains-fleet配置C++开发环境.md","signature":"11545804367575373335","tags":[]}],"folders":[],"id":"2","modified_time":"2022-12-13T12:17:53Z","signature":"79316831989105","version":3}