gpt4 book ai didi

c++ - 编译 boost::math 的性能测试应用程序

转载 作者:行者123 更新时间:2023-11-28 07:59:59 24 4
gpt4 key购买 nike

有没有人成功编译过boost::math库的性能测试应用程序?链接:http://www.boost.org/doc/libs/1_50_0/libs/math/doc/sf_and_dist/html/math_toolkit/perf/perf_test_app.html

我尝试通过在目录中运行 b2 进行编译,但出现了很多错误(超过 222000 行)。

前几行错误:

../test/erf_data.ipp:6:74: error: wrong number of template arguments (1, should be 2)
In file included from ../../../boost/math/tools/rational.hpp:13:0,
from ../../../boost/math/special_functions/log1p.hpp:18,
from ../../../boost/math/special_functions/gamma.hpp:35,
from test_erf.cpp:9:
../../../boost/array.hpp:60:11: error: provided for ‘template<class T, long unsigned int N> class boost::array’
In file included from test_erf.cpp:13:0:
../test/erf_data.ipp:6:80: error: template argument 1 is invalid
../test/erf_data.ipp:6:91: error: invalid type in declaration before ‘=’ token
../test/erf_data.ipp:7:38: error: ‘SC_’ was not declared in this scope
../test/erf_data.ipp:7:88: error: ‘SC_’ was not declared in this scope
In file included from test_erf.cpp:13:0:
../test/erf_data.ipp:7:136: error: ‘SC_’ was not declared in this scope

最佳答案

好吧,我让它可以正确编译和链接,但它不是 b2。我知道 OP 要求 b2 但我不熟悉它所以我提供了一个替代方案。此解决方案假定您已安装 Cmake。 (很容易做到,只要问谷歌博士。)

如果你去数学考试地点:

~/pathToBoost/libs/math/performance

然后您添加一个名为:

CMakeLists.txt

具有以下内容:

cmake_minimum_required(VERSION 2.8)
find_package(Boost COMPONENTS REQUIRED)
include_directories(${DEPENDENCY_DIR}/libboost/lib)

add_executable(main main.cpp test_reference.cpp)
target_link_libraries (main ${Boost_LIBRARIES} boost_regex)

然后创建一个名为build的文件夹:

mkdir build

并构建它。

cd build
cmake ..
make

这样做让我成功编译和构建。我从中得到一个名为 main 的程序。

希望这对您有所帮助。

关于c++ - 编译 boost::math 的性能测试应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11742347/

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