当前位置:网站首页>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 - the sum of the kth smallest array in the 21 ordered matrix
- 【C和指针第14章】预处理器
- leetcode-81. 搜索旋转排序数组 II(二分查找返回true/false)
- QT notes - sort a column specified by qtablewidget
- Buckle practice - 25 non overlapping intervals
- MySQL common functions
- 从零实现深度学习框架——再探多层双向RNN的实现
- 泰山OFFICE技术讲座:段落边框的布局难点
- Learn some programming: anti unemployment "vaccine"
- 雪花算法(PHP)
猜你喜欢

容错、熔断的使用与扩展

Reserved instances & Savings Plans

Miss waiting for a year! Baidu super chain digital publishing service is limited to 50% discount

QT notes - sort a column specified by qtablewidget

L1-059 ring stupid bell

Examples of map search

String matching KMP

Basic SQL server operation problems - only when lists are used and identity_ Only when insert is on can the display value be set for the identification column in the table
![[mathematical basis of Cyberspace Security Chapter 9] finite field](/img/2b/27ba1f3c6ec2ecff4538f9a63a79e8.jpg)
[mathematical basis of Cyberspace Security Chapter 9] finite field

Use of multithreading in QT
随机推荐
3、 Implementation principle of MFC message mapping mechanism
1.4.1 many, many symbols (cin/cout unbinding, O3 optimization)
有没有2、3w前期适合一个人干的创业项目呢?做自媒体可以吗?
How to upload pictures from typora to CSDN
ERROR: [Synth 8-439] module ‘xxx‘ not found not found 错误解决办法
In kuborad graphical interface, operate kubernetes cluster to realize master-slave replication in MySQL
Skillfully using command line parameters in Delphi to realize the trigger function of dragging files onto program icons
Buckle practice - 24 remove repeated letters
如何将Typora中图片上传到csdn
Buckle practice - 30 set the intersection size to at least 2
如何最快找出复杂代码运行时的函数调用流程
Reserved instances & Savings Plans
微信小程序-绘制仪表盘
Unity rotation test
Leecode-268. missing numbers (Application of XOR, find numbers that do not appear, find numbers that only appear once)
从零实现深度学习框架——再探多层双向RNN的实现
Convergence rules for 4 * 4 image weights
SQL multi condition query cannot be implemented
Equal principal increasing repayment / equal principal decreasing mortgage repayment calculator
Force deduction exercise - 26 split array into continuous subsequences






