问题
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 addfile.d
afterutilities.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