当前位置:网站首页>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新建工程时才开始起效。
参考以上方法,大家可以依据自己的喜好将构建目录放置到任何地方,并且更改成任何自己喜欢的名称。
边栏推荐
- 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
- Leetcode-81. search rotation sort array II (binary search returns true/false)
- try...finally总结
- 【功能测试】项目的测试——登录和发布文章功能
- Examples of map search
- Equal principal increasing repayment / equal principal decreasing mortgage repayment calculator
- The biggest crisis for testers in the workplace is not at the age of 30, but being laid off in middle age
- Threat hunting collection
- Blue team resource collection
- 理解数据的存与取
猜你喜欢

L1-059 ring stupid bell

Okaleido tiger NFT即将登录Binance NFT平台
![[mathematical basis of Cyberspace Security Chapter 9] finite field](/img/2b/27ba1f3c6ec2ecff4538f9a63a79e8.jpg)
[mathematical basis of Cyberspace Security Chapter 9] finite field

【功能测试】项目的测试——登录和发布文章功能

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

QT notes - custom data types

QT notes - qtablewidget table spanning tree, qtreewidget tree node generates table content

thinkphp 实现数据库备份

Delphi gexperts expert instructions for improving development efficiency
让一套代码完美适配各种屏幕
随机推荐
TypeNameExtractor could not be found
[Commons beanautils topic] 004 beanautils topic
Shell script case ---2
Buckle exercise - 35 combination sum II
Buckle practice - 24 remove repeated letters
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
Unity rotation test
VMware virtual machine and vSphere migrate to each other
一文看懂MES系统能实现企业哪些目标
Basic usage of GCC
Zhihuihuayun | cluster log dynamic collection scheme
ERROR: [Synth 8-439] module ‘xxx‘ not found not found 错误解决办法
leetcode-81. 搜索旋转排序数组 II(二分查找返回true/false)
QT notes - EventFilter event filter
[rust] what software should I use to develop rust? Recommended editors commonly used to support rust
In kuborad graphical interface, operate kubernetes cluster to realize master-slave replication in MySQL
微信公众号开发:素材管理(临时、永久)
Summary of MySQL database combined with actual SQL optimization of the project
Use and expansion of fault tolerance and fusing
Script redis write project notes






