当前位置:网站首页>Qt Creator怎样更改默认构建目录
Qt Creator怎样更改默认构建目录
2022-07-24 12:24:00 【天天进步2015】
用过VS的朋友都知道,用VS编译工程时会将生成的可执行文件放在当前工程目录下,使每个工程独立地成为一个整体,管理起来颇为方便;而Qt Creator则不同,编译程序时会创建一个与当前工程目录同级的构建目录,而且目录名称稀里哗啦的出奇的长,令人很不愉快。
那么,Qt Creator怎样才能更改默认构建目录,将可执行文件放入到工程目录下,并且让产生的目录名保持简洁,以便使目录结构显得清晰而有条理呢?
工具/原料
Qt Creator
一、问题描述
当我们使用Qt Creator编译工程时,会生成一个与工程目录同级的构建目录,而且目录名相当长,从而使得目录结构看起来显得有些凌乱。

那么,有没有什么办法能够使编译生成的目录位于当前工程目录下,并且目录名也显得清晰简洁呢?
END
二、解决办法
打开Qt Creator,点击菜单“工具”-“选项”。

在打开的选项窗口中点击左侧的“构建和运行”。

在构建和运行页面的最下方,便是指定构建目录的地方。

在这里我们可以看到,默认的构建目录为
../build-%{CurrentProject:Name}-%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}
其中,各部分元素的意义如下:
1)../ 当前目录的父目录(这部分用来指定构建目录处在什么位置,其中当前目录是指当前工程目录下)
2)build- 固定不变的字符,在目录名中原样显示
3)%{CurrentProject:Name} 变量值,即当前的工程名
4)- 固定不变的字符,在目录名中原样显示
5)%{CurrentKit:FileSystemName} 变量值,当前构建套件名,比如使用的是桌面版的VS2013进行编译,Qt版本为5.6,则为Desktop_Qt_5_6_0_MSVC2013
6)- 固定不变的字符,在目录名中原样显示
7)%{CurrentBuild:Name} 变量值,当前构建类型,比如是Debug还是Release
为了让大家更好地理解以上各部分的含义,下面就给出一个实际示例的图示。图中的构建目录名为 build-test1-Desktop_Qt_5_6_0_MSVC2013_32bit-Debug,与工程目录同级。

知道了各部分的含义,我们修改构建目录也就相当容易了。例如,假设我们想将构建目录放在工程目录下,目录名为构建类型,只需要在此作如下如图所示的修改即可。其中:
1)./ 表示当前目录(即工程目录下)
2)%{CurrentBuild:Name} 表示构建类型

修改之后,我们再来新建一个工程,测试修改效果。在这里,我分别进行以Debug和Release方式编译工程,可以看到,在工程目前下,分别新建了两个文件夹,而且文件夹的名称也不是之前的一长串了,而是分别为Debug和Release。

END
注意事项
注意,修改构建目录对当前正在打开的工程无效,需要在下一次使用Qt Creator新建工程时才开始起效。
参考以上方法,大家可以依据自己的喜好将构建目录放置到任何地方,并且更改成任何自己喜欢的名称。
边栏推荐
- Force deduction exercise - 26 split array into continuous subsequences
- [rust] what software should I use to develop rust? Recommended editors commonly used to support rust
- STM32 - Fundamentals of C language
- QT notes - EventFilter event filter
- Ah, I am uncle card space
- Aruba learning notes 04 Web UI -- Introduction to configuration panel
- Please ask whether Oracle CDC does not support checkpointing. When the task is suspended and restarted during the real-time collection process, is the data changed
- 【C和指针第14章】预处理器
- Understand what goals the MES system can achieve
- js图像转base64
猜你喜欢

C Advanced - data storage

Pushgateway installation and Prometheus configuration
![[function test] test of the project - login and post function](/img/64/c9bbf34964622f4f013b1184eeb1e0.jpg)
[function test] test of the project - login and post function

从零实现深度学习框架——再探多层双向RNN的实现

3、 Implementation principle of MFC message mapping mechanism

Conference publishing function of conference OA project

SQL multi condition query cannot be implemented

One of his birds sold for 60million -- the collection of eight mountain people in the Ming and Qing Dynasties

Okaleido tiger NFT is about to log in to binance NFT platform

Native Crash的一切
随机推荐
leetcode:51. N 皇后
js图像转base64
C Advanced - data storage
如何将Typora中图片上传到csdn
Use and expansion of fault tolerance and fusing
让一套代码完美适配各种屏幕
Basic usage of GCC
Delphi gexperts expert instructions for improving development efficiency
基于ARM和FPGA的数字示波器设计——QMJ
Implementing deep learning framework from zero -- further exploration of the implementation of multilayer bidirectional RNN
Wechat applet - drawing dashboard
[C and pointer Chapter 11] dynamic memory allocation
Acwing 92. recursive implementation of exponential enumeration
QT notes - sort a column specified by qtablewidget
Qt5.12 + vs2019 cannot locate the program input point in the dynamic link library
Using huggingface model to translate English
利用huggingface模型翻译英文
Native Crash的一切
Threat hunting collection
Skillfully using command line parameters in Delphi to realize the trigger function of dragging files onto program icons






