Qbs 导出项目不是暂时性的
Qbs Export item not transient
我有几个共享公共类的项目,因此我将更改项目布局,通过将它拆分为作为静态库实现的组件来反映这些依赖项。
现在我创建了一个模块"io",它使用导出块导出其包含路径。模块由"核心"依赖。然后,"核心"本身依赖于"应用程序",到目前为止没有什么特别的。
导出项的文档说它的属性是可传递的,但我得到几个错误从编译器编译时,找不到包含 from Core 的应用程序。看着编译器语句中,IO 导出的包含路径未在包含路径中列出。直接在应用程序中将依赖项添加到io时,一切正常。
我是否错误地使用了导出/依赖对,或者我的整体布局很糟糕。
为了澄清,我更改了 Qbs 的应用和库示例以反映我的布局。
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();
}
通过 IRC 到 Qbs Jira,并从开发人员那里得到答案,这是文档中的错误。要导出依赖项,必须将其导出,因此lib1.qbs需要像这样扩展
Exports {
Depends { name: "lib2" }
}
跟进:https://bugreports.qt.io/browse/QBS-928
相关文章:
- 使用C++库在Android项目中修改gradle中的cmake参数,用于插入指令的测试
- 无法在 CLion 中构建 C++ 项目
- 运行同一解决方案的另一个项目的项目
- CMake-按正确顺序将项目与C运行时对象文件链接
- 如何在选项卡视图Qt中设置一个新项目,并保存以前的项目
- 欧拉项目#8答案是大以获得有效答案
- 从链接列表c++中删除一个项目
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- 既然存在危险,为什么项目要使用-I include开关
- cmake在我的项目中所需的所有静态库都不成功
- QT通过C++添加映射QML项目
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- 在linux上调试巨大的C++项目
- 在其他文件中创建类时在 c++ 项目中不起作用
- 使外部项目可用于find_package CMake
- 在子目录中使用target_sources()命令时用于单元测试(qtest)的项目结构
- 使用外部SDK工具链文件在VisualStudio上生成项目编译错误
- 如何维护资源管理器项目视图中当前可见的项目列表
- 错误-我无法在VS2019中打开新的Qt项目
- Qbs 导出项目不是暂时性的