Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Haskell 阴谋集团:不';主要是';找到可执行test1的字段_Haskell_Main_Cabal - Fatal编程技术网

Haskell 阴谋集团:不';主要是';找到可执行test1的字段

Haskell 阴谋集团:不';主要是';找到可执行test1的字段,haskell,main,cabal,Haskell,Main,Cabal,我正试图与阴谋集团一起运行一个非常简单的“Hello World”项目 这是我保存项目的文件夹(ubuntu) mtt@mttPC:~/Documents/Haskell/test1$ ls dist Greetings.o Setup.hs test1.cabal Main.hs包含: module Greetings where main :: IO () main = print "hello" Hello world实际上可以工作: mtt@mttPC:~/D

我正试图与阴谋集团一起运行一个非常简单的“Hello World”项目

这是我保存项目的文件夹(ubuntu)

mtt@mttPC:~/Documents/Haskell/test1$ ls
dist          Greetings.o  Setup.hs  test1.cabal
Main.hs
包含:

module Greetings where

main :: IO ()
main = print "hello"
Hello world实际上可以工作:

mtt@mttPC:~/Documents/Haskell/test1$ runhaskell Main.hs configure --ghc
"hello"
test1.cabal
文件是使用
cabal init
生成的:

-- Initial test1.cabal generated by cabal init.  For further documentation,
--  see http://haskell.org/cabal/users-guide/

name:                test1
version:             0.1.0.0
-- synopsis:            
-- description:         
-- license:             
license-file:        LICENSE
author:              mtt
maintainer:           
-- copyright:           
-- category:            
build-type:          Simple
cabal-version:       >=1.8

executable test1
  -- main-is: Main.hs     
  -- other-modules:     
  build-depends:       base ==4.6.*
我不明白为什么:

mtt@mttPC:~/Documents/Haskell/test1$ cabal configure
Resolving dependencies...
Configuring test1-0.1.0.0...

Error: No 'Main-Is' field found for executable test1

您忘了取消注释告诉GHC要构建哪个模块作为主入口点的文件

...
executable test1
  main-is: src/Main.hs -- Or whatever is appropriate
  build-depends: base==4.6.*

谢谢,在
test1中取消注释
main is:main.hs
。。。正在预处理test1-0.1.0.0的可执行文件“test1”。。。[1/1]编译问候语(Main.hs,dist/build/test1/test1 tmp/hellives.o)警告:已使用-o重定向输出,但由于没有主模块,因此不会生成任何输出。。修好了。谢谢。