首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >堆栈构建的结果是"output is redirected with -o,但不会生成输出,因为没有主模块。“

堆栈构建的结果是"output is redirected with -o,但不会生成输出,因为没有主模块。“
EN

Stack Overflow用户
提问于 2018-06-03 01:15:11
回答 1查看 614关注 0票数 4

当谷歌搜索这个错误时,我没有看到任何相关的结果,所以我想我会把它贴出来。

代码语言:javascript
复制
stack build
Building all executables for `gitchapter' once. After a successful build of all of them, only specified executables will be rebuilt.
gitchapter-0.1.0.0: build (exe)
Preprocessing executable 'app' for gitchapter-0.1.0.0..
Building executable 'app' for gitchapter-0.1.0.0..
Preprocessing executable 'test' for gitchapter-0.1.0.0..
Warning: Enabling workaround for Main module 'Main' listed in 'other-modules'
Building executable 'test' for gitchapter-0.1.0.0..
illegaly!

<no location info>: error:
    output was redirected with -o, but no output will be generated
because there is no Main module.


--  While building custom Setup.hs for package gitchapter-0.1.0.0 using:
      /home/chris/.stack/setup-exe-cache/x86_64-linux-nopie/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-nopie/Cabal-2.0.1.0 build exe:app exe:test --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

它肯定与‘stack build’可执行文件定义有关--如果我去掉它,它就成功地完成了测试--但没有所需的测试可执行文件。

gitchapter.cabal

代码语言:javascript
复制
-- This file has been generated from package.yaml by hpack version 0.28.2.
--
-- see: https://github.com/sol/hpack
--
-- hash: a3e4a735ee8304dd50f5af53a64d7b639894cbcc24ba01d0171a588e67455018

name:           gitchapter
version:        0.1.0.0
author:         Chris Stryczynski
maintainer:     Chris Stryczynski
license:        BSD3
license-file:   LICENSE
build-type:     Simple
cabal-version:  >= 1.10

executable app
  main-is: Main.hs
  other-modules:
      BlogLiterately
      Example
      FileSection
      GHCi
      GHCiSession
      Git
      GitTextPartial
      Hart
      Operations
      Operations.Parsers
      QuasiText
      Render
      Section
      Test
      Paths_gitchapter
  hs-source-dirs:
      src
  build-depends:
      HUnit
    , QuickCheck
    , base >=4.9 && <4.11
    , directory
    , extra
    , filepath
    , foldl
    , mtl
    , optparse-applicative
    , pandoc-include-code
    , parsec
    , pretty-simple
    , process
    , regex-pcre
    , regex-posix
    , safe
    , string-conversions
    , system-filepath
    , template-haskell
    , text
    , transformers
    , turtle
    , unix
    , unordered-containers
  default-language: Haskell2010

executable test
  main-is: Test.hs
  other-modules:
      BlogLiterately
      Example
      FileSection
      GHCi
      GHCiSession
      Git
      GitTextPartial
      Hart
      Main
      Operations
      Operations.Parsers
      QuasiText
      Render
      Section
      Paths_gitchapter
  hs-source-dirs:
      src
  build-depends:
      HUnit
    , QuickCheck
    , base >=4.9 && <4.11
    , directory
    , extra
    , filepath
    , foldl
    , mtl
    , optparse-applicative
    , pandoc-include-code
    , parsec
    , pretty-simple
    , process
    , regex-pcre
    , regex-posix
    , safe
    , string-conversions
    , system-filepath
    , template-haskell
    , text
    , transformers
    , turtle
    , unix
    , unordered-containers
  default-language: Haskell2010
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-03 02:01:03

您需要设置

代码语言:javascript
复制
executable test
  ghc-options:  -main-is Test

在你的密谋档案里。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50659327

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档