gdc error “Error: module file is in file 'file.d' which cannot be read”

妖精的绣舞 提交于 2019-12-24 11:37:52

问题


I have searched and have seen similar errors but nothing specific as to how to fix this error. Using gdc (D compiler) I get this error message on my crunchbang debian linux machine:

gdc main.d fasta.d utilities.d
utilities.d:3: Error: module file is in file 'file.d' which cannot be read
import path[0] = /usr/include/d2/4.6/x86_64-linux-gnu
import path[1] = /usr/include/d2/4.6
utilities.d:3: Error: module file is in file 'file.d' which cannot be read
import path[0] = /usr/include/d2/4.6/x86_64-linux-gnu
import path[1] = /usr/include/d2/4.6

This is after freshly installing gdc with apt-get install.


回答1:


  • If file.d is your own file: You can add an include path with -I/path/to/files. I am not entirely sure how GDC handles it, but if you also add file.d after utilities.d (if it is in the current directory) it should detect that module too.
  • If you want the standard file library: import std.file;



回答2:


Whilst this may be of limited interest to the OP I've encountered the same behaviour in Mint. This is also a bug submitted in Launchpad, affecting raring. The recommended action, acompanying the bug-report is to install libphobos2-4*-dev, if its not present (please, notice the wildcard in the name -- there are two different libraries ).

The aformentioned action did nothing for my situation, even though Mint 15 is Raring-based...



来源:https://stackoverflow.com/questions/20888257/gdc-error-error-module-file-is-in-file-file-d-which-cannot-be-read

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!