Thread overview |
---|
December 16, 2013 Error: import `typename` is used as a type | ||||
---|---|---|---|---|
| ||||
Hello, i struggling now to make my D program better organized. As suggested here https://github.com/bioinfornatics/MakefileForD, i put all source files to src. Here is my current directory tree: ./ Makefile src/ main.d pcre/ capi.d pcre_regex.d Then i run make: $ make dmd -O -d -m32 -L-ldl -m32 -Isrc -c src/pcre/pcre_regex.d -ofbuild/src/pcre/pcre_regex.o src/pcre/pcre_regex.d(79): Error: import pcre_regex.pcre is used as a type What it could be ? pcre is defined in pcre/capi.d as: struct pcre {} Then it is used in pcre_regex.d this way: import pcre.capi; class RegExp { private pcre* _ppcre; // <-- Error: import pcre_regex.pcre is used as a type ... } |
December 16, 2013 Re: Error: import `typename` is used as a type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dfr | On Monday, 16 December 2013 at 06:33:14 UTC, Dfr wrote:
> Hello, i struggling now to make my D program better organized.
> As suggested here https://github.com/bioinfornatics/MakefileForD, i put all source files to src. Here is my current directory tree:
>
> ./
> Makefile
> src/
> main.d
> pcre/
> capi.d
> pcre_regex.d
>
> Then i run make:
>
> $ make
> dmd -O -d -m32 -L-ldl -m32 -Isrc -c src/pcre/pcre_regex.d -ofbuild/src/pcre/pcre_regex.o
> src/pcre/pcre_regex.d(79): Error: import pcre_regex.pcre is used as a type
>
> What it could be ?
>
> pcre is defined in pcre/capi.d as:
>
> struct pcre {}
>
> Then it is used in pcre_regex.d this way:
>
> import pcre.capi;
>
> class RegExp {
> private pcre* _ppcre; // <-- Error: import pcre_regex.pcre is used as a type
> ...
> }
it doesn't know what do you need, since there is two or more possible variants(pcre(package), pcre(struct), ...), so in such places just fully specify type name
class RegExp {
private pcre.capi.pcre _ppcre;
...
}
|
December 16, 2013 Re: Error: import `typename` is used as a type | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat |
Thank you, it's now works with full type name.
> On Monday, 16 December 2013 at 06:33:14 UTC, Dfr wrote:
>> Hello, i struggling now to make my D program better organized.
>> As suggested here https://github.com/bioinfornatics/MakefileForD, i put all source files to src. Here is my current directory tree:
>>
>> ./
>> Makefile
>> src/
>> main.d
>> pcre/
>> capi.d
>> pcre_regex.d
>>
>> Then i run make:
>>
>> $ make
>> dmd -O -d -m32 -L-ldl -m32 -Isrc -c src/pcre/pcre_regex.d -ofbuild/src/pcre/pcre_regex.o
>> src/pcre/pcre_regex.d(79): Error: import pcre_regex.pcre is used as a type
>>
>> What it could be ?
>>
>> pcre is defined in pcre/capi.d as:
>>
>> struct pcre {}
>>
>> Then it is used in pcre_regex.d this way:
>>
>> import pcre.capi;
>>
>> class RegExp {
>> private pcre* _ppcre; // <-- Error: import pcre_regex.pcre is used as a type
>> ...
>> }
>
> it doesn't know what do you need, since there is two or more possible variants(pcre(package), pcre(struct), ...), so in such places just fully specify type name
>
> class RegExp {
> private pcre.capi.pcre _ppcre;
> ...
> }
|
Copyright © 1999-2021 by the D Language Foundation