On Wednesday, 26 October 2022 at 16:58:08 UTC, H. S. Teoh wrote:
On Wed, Oct 26, 2022 at 04:20:01PM +0000, DLearner via
Digitalmars-d-learn wrote:
Hi
Never used DUB before.
Wanted to use a function stored in a module outside the main
source.
Main source has `import <modulename>;`
Put a line into the JSON: `"importPaths": "C:\\Users\\..."`
pointing to the directory holding the module.
`dub run` failed with `Expected JSON array, got string`.
Maybe try instead:
"importPaths": [ "C:\\Users\\..." ]
since the error message indicates that it expects an array, not
a string.
T
Thanks for this.
Following your suggestion, seems that DUB found the module (as it
got through to the linking step without complaint), but then the
linker failed to resolve the function name.
However, when I moved the module to the project `'source'`
directory (and took out the `importPaths` JSON entry), everything
worked.
But I don't really want to do this - the module is my collection
of utilities, used in a variety of projects, so doesn't really
belong within one specific project.
Best regards