C++ building error for a simple code using armadillo and hdf5 libraries

偶尔善良 提交于 2019-12-01 11:28:38

Due to various issues with differing versions of HDF5 libraries on Linux-based systems, the authors of Armadillo have disabled automatic detection of the HDF5 library. If you want to use HDF5 with Armadillo, there are two options:

1. Unpack the armadillo .tar.gz package, and edit the CMakeLists.txt file. Uncomment lines 231 to 238, starting with find_package(HDF5) (ie. remove the # characters). Once you have modified CMakeLists.txt, run the cmake based installation as described in the README.txt file.

OR

2. Install Armadillo normally (without modifying CMakeLists.txt), and then compile your programs using (all on one line):

g++ main.cpp -o main -O2 -DARMA_DONT_USE_WRAPPER -DARMA_USE_BLAS -DARMA_USE_LAPACK -DARMA_USE_HDF5 -lblas -llapack -lhdf5

Bonus points: if you have the high-speed OpenBLAS library installed and want Armadillo to use it instead of standard BLAS, change -lblas to -lopenblas

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!