I'm building my first program with dub. It appears I can import and use a struct from a "library". But the template struct is undefined unless I change the target type to "sourceLibrary".
The sources are like this:
// library ////////////////
// shapes.d
module core.shapes;
struct triangle
{
}
// math.d
module core.math;
import std.stdio;
struct MATRIX(T, int R, int C)
{
}
// package.d
module core;
public
{
import core.math;
import core.shapes;
}
/////////////
// executable //////////////////
import std.stdio;
import core.math;
import core.shapes;
int main(string[] argv)
{
triangle t;
MATRIX!(float, 4, 4) a;
writeln(t);
return 0;
}
// dub.sdl
targetType "none"
dependency ":example" version="*"
subPackage {
name "core"
targetType "library"
sourcePaths "core"
importPaths "."
}
subPackage {
name "example"
targetType "executable"
sourceFiles "example/main.d"
importPaths "example"
dependency "proj:core" version="*"
}
I get Error: template instance MATRIX!(float, 4, 4)
template MATRIX
is not defined
What am I doing wrong here?