当前位置:网站首页>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新建工程时才开始起效。
参考以上方法,大家可以依据自己的喜好将构建目录放置到任何地方,并且更改成任何自己喜欢的名称。
边栏推荐
猜你喜欢

Aruba learning notes 04 Web UI -- Introduction to configuration panel

字符串匹配的KMP

Convergence rules for 4 * 4 image weights
![[mathematical basis of Cyberspace Security Chapter 3] congruence](/img/00/42a5f7f6f0e8a50884f4639767949f.jpg)
[mathematical basis of Cyberspace Security Chapter 3] congruence

3、 Implementation principle of MFC message mapping mechanism

Equal principal increasing repayment / equal principal decreasing mortgage repayment calculator

How to find out the function calling process of complex code running as soon as possible

TypeNameExtractor could not be found
![[data mining engineer - written examination] sheen company in 2022](/img/67/c61dfce8c397ab55fab835b6e81a5f.jpg)
[data mining engineer - written examination] sheen company in 2022

How to realize the function of grabbing red envelopes in IM system?
随机推荐
Wechat official account development: Material Management (temporary and permanent)
做自媒体视频剪辑有免费可商用的素材网站吗?
STM32 - Fundamentals of C language
Learning materials about red team
Buckle exercise - 35 combination sum II
Install JMeter
Use of multithreading in QT
雪花算法(PHP)
泰山OFFICE技术讲座:段落边框的布局难点
Okaleido tiger NFT is about to log in to binance NFT platform
Buckle practice - maximum number of 28 splices
QT notes - qtablewidget table spanning tree, qtreewidget tree node generates table content
Why is the datetime type field 8 hours earlier when I use flinkcdc to read MySQL's binlog?
Understand what goals the MES system can achieve
Makefile quick use
微信小程序生成二维码
QT | summary of the use of edit box
如何将Typora中图片上传到csdn
Ansible的安装及部署
Summary of MySQL database combined with actual SQL optimization of the project






