Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/136.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
C++ 使用C++;带有内联c-cpp的库(boost)_C++_Haskell_Boost_Ffi - Fatal编程技术网

C++ 使用C++;带有内联c-cpp的库(boost)

C++ 使用C++;带有内联c-cpp的库(boost),c++,haskell,boost,ffi,C++,Haskell,Boost,Ffi,在Haskell中,我想在的帮助下从调用函数 下载boost库后,如何配置cabal文件以及stack.yaml中的extra lib dirs和extra include dirs 在cabal文件中,我写到:extra-lib-dirs:boost,我在extra-lib-dirs和extra-include-dirs中尝试了几个文件夹,但我总是得到缺少的C-library:boost 编辑 这是我在@n.m.评论后的尝试。在stack.yaml中: extra-include-dirs:

在Haskell中,我想在的帮助下从调用函数

下载
boost
库后,如何配置
cabal
文件以及
stack.yaml
中的
extra lib dirs
extra include dirs

cabal
文件中,我写到:
extra-lib-dirs:boost
,我在
extra-lib-dirs
extra-include-dirs
中尝试了几个文件夹,但我总是得到
缺少的C-library:boost

编辑 这是我在@n.m.评论后的尝试。在
stack.yaml
中:

extra-include-dirs:
- U:\Data\C\boost_1_64_0
在阴谋集团档案中:

  extra-libraries:     stdc++
  c-sources:           src/Main.cpp
我的模块:

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ForeignFunctionInterface #-}

module Main
  where
import qualified Language.C.Inline.Cpp as C

C.context C.cppCtx

C.include "<iostream>"
C.include "<boost/math/special_functions/owens_t.hpp>"

main :: C.CDouble -> C.CDouble -> IO ()
main h a = do
  [C.block| void {
      std::cout << "Hello, Owen! " << boost::math::owens_t($(double h), $(double a)) << std::endl;
    } |]
编辑
如果我这样做并运行一个可执行文件,这是可行的。但是我想在GHCi中使用它。

编辑中发布的代码在GHCi中使用
ghc 8.2.1

Prelude Main> main 0.5 0.5
Hello, Owen! 0.0644886

Boost是一个库集合。它通常分为几十个库文件。您的系统不太可能只有一个名为boost的库。告诉您要调用哪些函数可能会有所帮助。@n.m.好的,谢谢。我想在
boost/math/special\u functions
中调用
owens\u t
。owens\u t是一个仅用于模板的函数,不在任何可链接库中。这意味着它不可能?悲哀的是,我可以从
R
调用它。不,这意味着您没有任何可链接的库。您只需指定
额外包含目录
Prelude Main> main 0.5 0.5
Hello, Owen! 0.0644886