gpt4 book ai didi

haskell - 堆栈构建结果为 "output was redirected with -o, but no output will be generated because there is no Main module."

转载 作者:行者123 更新时间:2023-12-02 11:08:27 27 4
gpt4 key购买 nike

当谷歌搜索此错误时没有看到任何相关结果,所以我想发布它。

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

它肯定与“测试”可执行文件定义有关 - 就好像我删除它一样,它成功完成了堆栈构建 - 但没有所需的测试可执行文件。

gitchapter.cabal

-- 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

最佳答案

您需要设置

executable test
ghc-options: -main-is Test

在你的 cabal 文件中。

关于haskell - 堆栈构建结果为 "output was redirected with -o, but no output will be generated because there is no Main module.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50659327/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com