如何在 QtCreator 中设置我的项目层次结构? [英] How can I set up my project hierarchy in QtCreator?

查看:43
本文介绍了如何在 QtCreator 中设置我的项目层次结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 QtCreator 很陌生,所以也许我把我的心留在了 eclipse-ville,但我一生都无法理解我应该如何在 QtCreator 中设置项目层次结构.我知道有一个选项可以创建一种根项目,然后从那里向它添加子项目,这是有道理的,但这让我想知道在创建项目时是否需要这样做,例如我可以在一个项目中创建一个库,然后在另一个项目中引用它吗?

I'm quite new to QtCreator, so perhaps I left my heart in eclipse-ville, but I can't for the life of me understand how I should be setting up a project hierarchy in QtCreator. I understand there is an option to create a kind of root project and then from there add sub-projects to it, which makes sense but it leaves me wondering whether or not this is necessary at the time of creating the project, e.g. can I just create a library in one project and reference it later by another project?

我已经尝试通过创建一个新的 subdirs 项目然后将主程序添加为子项目来设置一个全面类型的项目,但是我应该如何添加我的库项目?

I've tried setting up a blanket type of project by creating a new subdirs project and then adding the main program as a subproject, but then how should I add my library project?

理想情况下,我想创建一个项目作为主应用程序并引用另一个项目作为库.帮助?

Ideally, I'd like to create one project as the main application and reference another project as a library. Help?

推荐答案

Qt Creator 文档 包含两个部分,可以帮助您找到问题的答案:

The documentation of Qt Creator contains two sections that may help you find the answers to your questions:

您可以在这里找到一个非常简单的示例项目:QtSymbianDllExample.它旨在演示如何在 Symbian 平台上使用 Qt 创建和使用 DLL".它是 Symbian 开发的示例,但现在无关紧要,我没有 Symbian 手机.重要的是它包含一个根项目(QtSymbianDllExample\qtssymbiandllexample.pro)和两个子项目(QtSymbianDllExample\qtenginedll\qtenginedll.pro、QtSymbianDllExample\testui_simpledllengine\testui_simpledllengine.pro),您可以检查并与您的项目进行比较.我已经检查我可以通过执行以下步骤来构建根项目:

You can find a really simple sample project here: QtSymbianDllExample. "It is intended to demonstrate how to create and use a DLL with Qt on the Symbian platform". It is a sample for Symbian development but that is irrelevant now, I do not have a Symbian phone. What is important is that it contains a root project (QtSymbianDllExample\qtssymbiandllexample.pro) and two subprojects (QtSymbianDllExample\qtenginedll\qtenginedll.pro, QtSymbianDllExample\testui_simpledllengine\testui_simpledllengine.pro) which you can examine and compare to you projects. I have checked that I can build the root project by doing the following steps:

  1. http://www.qt.io/download/
  2. 下载并解压 QtSymbianDllExample.zip
  3. 运行 Qt Creator
  4. 文件/打开文件或项目...选择qtssymbiandllexample.pro
  5. 构建/运行 qmake
  6. 构建/构建项目qtsymbiandllexample"

这篇关于如何在 QtCreator 中设置我的项目层次结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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