Error: import `typename` is used as a type

evilrat evilrat666 at gmail.com
Sun Dec 15 23:53:22 PST 2013


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;
...
}



More information about the Digitalmars-d-learn mailing list