How to organize a project with local scripts in subdirectories using dub?
Pavel Shkadzko
p.shkadzko at gmail.com
Wed Dec 11 11:18:58 UTC 2019
I have the following project structure.
my_proj/
script_1/runme_1.d
script_2/runme_2.d
evaluator.d
The project has a library dependency:
"dependencies": {
"mir": "~>3.2.0",
},
The "evaluator.d" script contains some general functions that
convert dataset and pass it to "runme_1.d" and "runme_2.d"
scripts the following way:
import mir.ndslice;
void main() {
import script_1.runme_1 : runTask1;
import script_2.runme_2 : runTask2;
mir_slice!(real*, 1LU, cast(mir_slice_kind)2)[]) dataset =
convertDataset("data.txt");
runTask1(dataset);
//runTask2(dataset); //disable for now
}
So, basically what I need is to be able to run "./evaluator" and
get the results by running the corresponding scripts.
I am trying to build the project the following way:
dub build --compiler=ldc2 --single evaluator.d
I get the following error:
Performing "debug" build using ldc2 for x86_64.
mir-core 1.0.2: target for configuration "library" is up to date.
mir-algorithm 3.7.2: target for configuration "default" is up to
date.
mir-linux-kernel 1.0.1: target for configuration "library" is up
to date.
mir-random 2.2.8: target for configuration "extended" is up to
date.
survey ~master: building configuration "application"...
lld-link: error: undefined symbol:
_D5runme_114runTask1FS3mir7ndslice5slice__T9mir_sliceTPeVmi2VEQBoQBnQBi14mir_slice_kindi2ZQBvZv
>>> referenced by C:\Users\user\my_proj\evaluator.d:89
>>> .dub\obj\evaluator.obj:(_Dmain)
Error: linking with LLD failed
ldc2 failed with exit code 1.
How should I organize my project for this kind of setup?
(I am sorry for the absence of code formatting. I could not find
any quick howto here)
More information about the Digitalmars-d-learn
mailing list