我有一个src
目录。在这个目录中,我有Main.hs
文件和Test
目录。在Test
目录中,我有Test.hs
模块。我需要用cabal编译它。
在我的卡特尔文件中,我有:
Executable main
-- .hs or .lhs file containing the Main module.
Main-is: src/Main.hs
和
-- Modules not exported by this package.
Other-modules: Test.Test
当我执行cabal configure
时,它是正常的,但是当我尝试cabal build
时,我得到以下错误:
cabal build
Preprocessing executables for main-0.0.1...
cabal: can't find source for Test/Test in ., dist/build/autogen
如何使用.hs
文件正确地构建Main.hs
和其他一些目录?
谢谢。
发布于 2011-12-17 14:24:41
如果在src/Test/Test.hs
中定义了Test.Test
,则需要
hs-source-dirs: src
在你的Cabal文件的Executable部分。请注意,您的main-is
文件路径应该是相对于源目录的,因此在本例中,您应该将其更改为Main.hs
。
https://stackoverflow.com/questions/8543039
复制相似问题