Using D libraries with SDL. Error: "Cannot find module protobuf'

Nicol Farran Terra nicolterramaze at gmail.com
Sat Aug 24 11:34:18 UTC 2024


On Saturday, 24 August 2024 at 06:35:50 UTC, IchorDev wrote:
> On Saturday, 24 August 2024 at 00:24:12 UTC, Nicol Farran Terra 
> wrote:
>> I am not sure if this expected behavior, but importing this in 
>> my app.d does not work. I get an error about a missing import.
>
> You are importing `google.protobuf`, right?
> Providing the app.d would be helpful, or at least a snippet of 
> it with the import that’s giving you the ‘error’—presumably a 
> compiler error?
>
>> I ran to my 'root' where my dub.sdl was, ran the build for the 
>> library which worked, but when I went back to my file, I get 
>> the same behavior. I am not sure what to make of this.
>
> Could you please elaborate about what this means? It’s a bit 
> confusing.

No, I am just importing 'protobuf'. Also  the app is literally 
the base app when you run dub.init.
Here is a more exact error.
app.d(2): Error: unable to read module `protobuf`
app.d(2):        Expected 'google/protobuf.d' or 
'google/protobuf/package.d' in one of the following import paths:
import path[0] = /usr/include/dlang/dmd



Also, I tried with both google.protobuf and just protobuf. Same 
error. Although I do remember I got something interesting when 
trying to build a subproject of this one (it wasnt there for some 
reason)
Uhh, just 'root'. Where my dub.sdl is?
It is not overall project root, that is where my Package.swift 
files. It is in my Sources/source (yes because Dub does that by 
default + app.d) and in Sources is where my dub.sdl.
If you go to where my folder location is, and run dub build. It 
'works' fine if you run 'dub build'. Although only if you just 
import anything in std. If you try to import protobuf in the 
app.d, it just wont work. Here is that error.
source/app.d(2,8): Error: unable to read module `protobuf`
source/app.d(2,8):        Expected 'protobuf.d' or 
'protobuf/package.d' in one of the following import paths:
import path[0] = source/
import path[1] = 
../../../../.dub/packages/protobuf/0.6.2/protobuf/src/
import path[2] = /usr/include/dlang/dmd
Error /usr/bin/dmd failed with exit code 1.



More information about the Digitalmars-d-learn mailing list