I found a solution for the issue: Simply split the main() from the rest of the Project . Here is the updated Production Code Product specification:
import qbs
Project {
name: "TheRealApp"
QtApplication {
name: "TheApp"
Depends { name: "cpp" }
Depends { name: "library" }
Group {
name: "Main"
files: [
"main.cpp",
]
}
}
StaticLibrary{
name: "library"
Depends { name: "cpp" }
Depends { name: "Qt.core" }
Export {
Depends { name: "cpp" }
cpp.includePaths: product.sourceDirectory
}
Group{
name: "Grp_Main"
files: [
"mycustomclass.cpp",
"mycustomclass.h",
]
}
}
}