【问题标题】:<no location info>: error: can't find file<无位置信息>:错误:找不到文件
【发布时间】:2018-03-23 14:36:41
【问题描述】:

我在 mac 上使用 haskell 版本 8.2.2,目前编译文件时遇到问题:

我的终端:

$ls 
try.hs 
$ ghc -o try try.hs
<no location info>: error: can't find file: try.hs

ls -l 之后的终端:

total 0 
-rw-rw-r--@ 1 <>  <> 0 Mar 23 15:54 try.hs 

ls -l@ 之后的终端:

total 0
-rw-rw-r--@ 1 <>  <>  0 Mar 23 15:54 try.hs 
com.apple.TextEncoding  15 
com.apple.metadata:_kMDItemUserTags 42 
com.apple.metadata:kMDLabel_z4p7jqbpj7dblx5lt33gtc742u  105 

【问题讨论】:

  • 如果你只使用ghc try.hs,你会得到什么? ghc 不是 gcc。默认情况下,它根据输入文件命名二进制文件。
  • 不幸的是同样的错误
  • 不幸的是不一样的错误。对我来说,在 Ubuntu 17.10 上使用 ghc 8.0.2,使用像这样的 -o 标志就可以了。
  • try.hs 的权限是什么? try.hs的内容是什么?当前目录的权限是什么?
  • @hhwwww 和当前目录的权限?粘贴ls -ld . try.hs 的输出的奖励积分,这样我们就不必准确猜测您模糊的“权限是读写”是什么意思。

标签: macos file haskell filesystems file-attributes


【解决方案1】:

我怀疑您将一个不存在的文件符号链接到try.hs。这是我的测试目录中的示例,在该目录中我可以看到与您相同的错误:

% ls try.hs
try.hs
% ghc try.hs
<no location info>: error: can't find file: try.hs
% ls -l
total 0
lrwxrwxrwx. 1 <redacted> <redacted> 5 Mar 23 10:57 try.hs -> wrong

从权限开头的l 和文件名后面的-&gt; wrong 可以看出,这里的try.hswrong 的符号链接。但是没有名为wrong的文件。

【讨论】:

    猜你喜欢
    • 2015-01-04
    • 1970-01-01
    • 2021-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多