Importing modules under DUB on Windows
Hipreme
msnmancini at hotmail.com
Thu Oct 27 00:35:26 UTC 2022
On Wednesday, 26 October 2022 at 22:51:53 UTC, DLearner wrote:
> On Wednesday, 26 October 2022 at 18:53:58 UTC, Hipreme wrote:
>> On Wednesday, 26 October 2022 at 18:37:00 UTC, DLearner wrote:
>>> 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:
>>>>> [...]
>>>>
>>>> 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
>>
>> The linker failed to resolve because it didn't include the
>> symbols you imported.
>> Think of import a way to the compiler resolve the compilation.
>> Think of source a way to both the compiler and the linker to
>> resolve compilation and linking.
>>
>> If you give only the import path, you will need a library.
>>
>> What you actually want is to put your new importPath to the
>> JSON array `sourcePaths`
>
> Added `"sourcePaths": [ "C\\Users\\..." ]`
> Unfortunately failed with
> `core.exception.AssertError at source\dub\internal\vibecompat\inet\path.d(222): Trying to append absolute path.`
>
> I tried to construct a relative path to the module directory
> from the project directory, that didn't work either.
Okay. So this error is very strange, the other thing I can give
you advice is:
If your other thing is another dub project, you can add it as a
dependency by putting in your dub.json
```json
"dependencies" : {
"your_project_name" : {"path" : "your/path/here"}
}
```
AFAIK, there is no problem in putting an absolute path
dependency, in fact, I'm using things from another drive letter.
More information about the Digitalmars-d-learn
mailing list