首页 > 解决方案 > 在 Windows 上使用带有 Cxx.jl 的 Julia 中的 boost 库

问题描述

我在 Julia 1.3.1 中使用 Cxx 来使用 boost 库的功能,安装此类库后它在 Linux 上正常工作,但在 Windows 中我从未让它工作。这是我写的模块:

module Airyzero

#Returns zeros of Airy's function

using Cxx;
export airyzero
cxx""" 
    #include<iostream>
    #include <boost/math/special_functions/airy.hpp>
    #include <boost/multiprecision/cpp_dec_float.hpp>
    typedef boost::multiprecision::cpp_dec_float_50 float_type;
    """

cxx"""
    double airyzero1(int y) {
    return boost::math::airy_ai_zero<double>(y);
    }
    """

    airyzero(ind) = @cxx airyzero1(ind)

end

所以我可以在我的代码中使用airy_ai_zeroboost中的函数。airyzero我需要它也可以在 Windows 中工作,因为我实验室的计算机都没有使用 Linux(我的同事也没有)。

标签: c++windowsboostjulia

解决方案


我在头目录中添加了安装 boost 的路径:

if Sys.iswindows()
   const pathboost = "C:\\boost_1_73_0";
   addHeaderDir(pathboost,kind=C_System);
end

推荐阅读