【Qt】运行报错Could not create directory “E:\xxxx-Debug“

本文记录了一起在本地打开其他工作站Qt工程时遇到的运行错误,错误出现在尝试创建目录及执行qmake步骤时。通过切换到设计模式,关闭shadowbuild并重新使用本地环境build,成功解决了因版本不匹配导致的问题。强调了在不同工作站使用工程时应注意版本兼容性,并介绍了shadowbuild的作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、现象

在本地打开一个其他工作站上的Qt工程,按运行提示错误信息如下:

21:30:20: 为项目timer执行步骤 ...
21:30:20: Could not create directory "E:\program\qt\timer\build-E:programqtu0009imeru0009imeru0009imer-Desktop_Qt_5_9_9_MSVC2015_64bit-Debug"
Error while building/deploying project timer (kit: Desktop Qt 5.9.9 MSVC2015 64bit)
When executing step "qmake"
21:30:20: Elapsed time: 00:00.

21:30:20: 为项目timer执行步骤 ...
21:30:20: Could not create directory "E:\program\qt\timer\build-E:programqtu0009imeru0009imeru0009imer-Desktop_Qt_5_9_9_MSVC2015_64bit-Debug"
Error while building/deploying project timer (kit: Desktop Qt 5.9.9 MSVC2015 64bit)
When executing step "qmake"
21:30:20: Elapsed time: 00:00.

二、分析

首先明确此错误在run时触发,其次在run前的build阶段出错,接着是执行qmake时触发,最后提示使用的kit是Desktop Qt 5.9.9 MSVC2015 64bit。

三、解决

3.1开发栏中切换至设计模式

如图:

此处根据shadow build的path可以知道,在本地是使用5.9.9进行build。

3.2打开文件夹目录

可看到曾经build过5.14.2版本程序且有发布release版本,因此确定是build版本问题。

3.3将shadow build关闭,使用本地环境重新build

3.4按F5尝试运行

运行正常:

21:30:04: Debugging E:\program\qt\timer\timer\debug\timer.exe ...
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
21:30:07: Debugging of E:\program\qt\timer\timer\debug\timer.exe has finished.

21:40:54: Debugging E:\program\qt\timer\timer\debug\timer.exe ...
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile

21:30:04: Debugging E:\program\qt\timer\timer\debug\timer.exe ...
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
21:30:07: Debugging of E:\program\qt\timer\timer\debug\timer.exe has finished.

21:40:54: Debugging E:\program\qt\timer\timer\debug\timer.exe ...
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile

四、总结

在不同工作站上使用工程时,应首先注意版本问题,特别是在低版本打开高版本这种情况下极易发生各种兼容性问题。因此,能本地重新编译就重新编译,只要源码没问题就行。

另外,shadow build的作用是将build前后的代码文件分隔开,使工程看起来更立体,方便源码文件管理而已,默认开启。也有一种说法是可以使用一份源码文件编译出不同环境的文件。

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值