首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Qbs出口项目不是暂时的

Qbs出口项目不是暂时的
EN

Stack Overflow用户
提问于 2016-02-01 13:33:51
回答 1查看 363关注 0票数 0

我有几个共享公共类的项目,因此我将更改项目布局以反映这些依赖关系,将其分解为作为静态库实现的组件。

现在,我创建了一个模块'io‘,它使用导出块导出其包含路径。模块依赖于“核心”。“核心”本身就是“应用程序”所依赖的,到目前为止没有什么特别之处。

导出项的文档说它的属性是传递的,但是我在编译包含在核心的应用程序时从编译器那里得到了几个错误。查看编译器语句,io导出的包含路径没有在包含路径中列出。在应用程序中将依赖项直接添加到io中时,一切都正常。

我是使用了导出/依赖对错误的,还是我的整体布局不好。

我更改了Qbs的应用程序和库示例,以反映我的布局以求澄清。

代码语言:javascript
复制
app
|- main.cpp

lib1
|- lib.cpp

lib2
|- lib.cpp
|- Test.h


=== app-and-lib.qbs
import qbs 1.0

Project {
    references: [
        "app/app.qbs",
        "lib1/lib1.qbs",
        "lib2/lib2.qbs"
    ]
}

=== app.qbs
import qbs 1.0

Product {
    type: "application"
    name : "app-and-lib-app"
    files : [ "main.cpp" ]
    Depends { name: "cpp" }
    Depends { name: "lib1" }
}

=== lib1.qbs
import qbs 1.0

Product {
    type: "staticlibrary"
    name: "lib1"
    files: [ "lib.cpp" ]
    cpp.defines: ['CRUCIAL_DEFINE']
    Depends { name: 'cpp' }
    Depends { name: "lib2" }
}

=== lib2.qbs
import qbs 1.0

Product {
    type: "staticlibrary"
    name: "lib2"
    files: [
        "Test.h",
        "lib.cpp",
    ]
    cpp.defines: ['CRUCIAL_DEFINE']
    Depends { name: 'cpp' }

    Export {
      Depends { name: "cpp" }
      cpp.includePaths: "."
    }
}

=== lib.cpp
#include <stdio.h>
#include "Test.h"


#ifndef CRUCIAL_DEFINE
#   error CRUCIAL_DEFINE not defined
#endif

int bla()
{
    puts("Hello World!");
    return 2;
}

=== main.cpp
#include <stdio.h>
#include "Test.h" // Error cannot found Test.h

int bla();
int main()
{
  Test t = new Test();
    return bla();
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-02-03 19:59:47

通过IRC到Qbs Jira,并从开发人员那里得到了答案,即这是文档中的一个错误。要导出依赖项,必须导出它,因此lib1.qbs需要像这样进行扩展

代码语言:javascript
复制
Exports { 
  Depends { name: "lib2" }
}

跟进:https://bugreports.qt.io/browse/QBS-928

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35131878

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档