Qt不在Linux的debug/release文件夹中创建输出文件 [英] Qt does not create output files in debug/release folders in Linux

查看:402
本文介绍了Qt不在Linux的debug/release文件夹中创建输出文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Ubuntu上构建Qt应用程序时,它会将输出文件放在主解决方案文件夹中,而不是在Windows中将其放到release/debug文件夹中.

When I build Qt applications on Ubuntu it puts the output files in the main solution folder as opposed to release/debug folders as it does on Windows.

这是有问题的,因为有时输出文件需要在构建过程中运行(例如,运行单元测试).

This is problematic because sometimes the output files need to be run as part of the build process (for example to run unit tests).

我知道这与qmake.conf文件有关,但是我不确定该怎么办.

I have an idea this has something to do with the qmake.conf files but I'm unsure what to do about it.

所以我的问题是:

  1. 为什么存在这种差异(可能就是我吗?)
  2. 我应该如何确保我的应用程序可以在Windows和Ubuntu上正确构建?

推荐答案

我假设您正在使用qmake进行实际的构建.您可以编辑项目文件以将输出放置在不同的目录中,如下所示:

I assume you're using qmake to do the actual building. You can edit the project files to put the output in different directories like this:

# only for unix:
unix {
    # in debug mode...
    CONFIG(debug, debug|release) {
        DESTDIR = debug
    }
    else {
        DESTDIR = release
    }
}

很显然,为了使其正常工作,您需要同时构建调试和发布可执行文件.有关此主题的更多信息,请参见此处

Obviously in order for this to work you need to be building both debug and release executables. More information on this topic can be found here

欢呼

这篇关于Qt不在Linux的debug/release文件夹中创建输出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆