"Error: Undefined identifier" when moving import to another module
nrgyzer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Oct 20 09:55:39 PDT 2014
On Monday, 20 October 2014 at 16:05:14 UTC, nrgyzer wrote:
> On Sunday, 19 October 2014 at 22:22:05 UTC, Joakim wrote:
>> On Sunday, 19 October 2014 at 09:39:05 UTC, nrgyzer wrote:
>>> Hi guys,
>>>
>>> when I do the following:
>>>
>>> module myMain;
>>>
>>> import example;
>>> import std.traits;
>>> import my.static.library.binding;
>>>
>>> static this()
>>> {
>>> foreach ( m; __traits(allMembers, example) )
>>> {
>>> static if ( isCallable!(mixing(m) )
>>> {
>>> // ... do something here
>>> }
>>> }
>>> }
>>>
>>> void main() { /* do something here */ }
>>>
>>> And my example-module looks like:
>>>
>>> module example;
>>>
>>> void exmapleFunction()
>>> {
>>> // do something here
>>> }
>>>
>>> I can compile my application without any error, BUT when I
>>> move the import of "my.static.library.binding" to the
>>> example-module:
>>>
>>> module example;
>>>
>>> import my.static.library.binding;
>>>
>>> void exmapleFunction()
>>> {
>>> // do something here
>>> }
>>>
>>> ... I'm getting many error messages like these:
>>>
>>> myMain.d-mixin-11(11): Error: undefined identifier
>>> _D12TypeInfo_xAa6__initZ
>>> myMain.d-mixin-11(11): Error: undefined identifier
>>> _D49TypeInfo_xAS3std8typecons16__T5TupleTkTkTkZ5Tuple6__initZ
>>> myMain.d-mixin-11(11): Error: undefined identifier
>>> _D75TypeInfo_xAS3std3uni38__T13InversionListTS3std3uni8GcPolicyZ13InversionList6__initZ
>>> myMain.d-mixin-11(11): Error: undefined identifier
>>> _D55TypeInfo_xAE3std5regex15__T6ParserTAyaZ6Parser8Operator6__initZ
>>> myMain.d-mixin-11(11): Error: undefined identifier
>>> _D31TypeInfo_xAS3std5regex8Bytecode6__initZ
>>> myMain.d-mixin-11(11): Error: undefined identifier
>>> _D110TypeInfo_xAS3std3uni152__T4TrieTS3std3uni20__T9BitPackedTbVmi1Z9BitPackedTwVmi1114112TS3std3uni23__T9sliceBitsVmi8Vmi21Z9sliceBitsTS3std3uni22__T9sliceBitsVmi0Vmi8Z9sliceBitsZ4Trie6__initZ
>>> myMain.d-mixin-11(11): Error: undefined identifier
>>> _D45TypeInfo_xS3std5regex14__T7ShiftOrTaZ7ShiftOr6__initZ
>>> myMain.d-mixin-11(11): Error: undefined identifier
>>> _D11TypeInfo_xw6__initZ
>>> myMain.d-mixin-11(11): Error: undefined identifier
>>> _D11TypeInfo_xb6__initZ
>>> myMain.d-mixin-11(11): Error: undefined identifier
>>> _D13TypeInfo_xAya6__initZ
>>> myMain.d-mixin-11(11): Error: undefined identifier
>>> _D41TypeInfo_xS3std5regex12__T5StackTkZ5Stack6__initZ
>>>
>>> I'm having no idea what's going wrong here. I'm simply moving
>>> the import from the file where my main() is located in to the
>>> example-module. When removing the import of
>>> "my.static.library.binding" in the example-module allows me
>>> to successfully compile everything. But I need the import in
>>> the example-module. Any suggestions what's going wrong
>>> here/how I can solve the error?
>>
>> An import is private by default:
>>
>> http://dlang.org/module.html
>>
>> When you move the import of my.static.library.binding to the
>> "example" module, its declarations are no longer available in
>> the "myMain" module. You'd have to make it a "public import
>> my.static.library.binding" to make it available to other
>> modules.
>
> Hm, I made it public and I'm getting the same error. I also
> imported the same module in my main which also gives me the
> same error.
I temporarely solved the error by making the import in the module
where the main()-function is located in public and importing this
file into the other module. This solved the error but is not a
perfect solution...
More information about the Digitalmars-d-learn
mailing list