Vs2015+armadillo+hdf5

Source: Internet
Author: User
Tags lapack

A few years did not log in csdn, think about these two days toss content, or write a mark, hope can also help others. Recently in writing some calculation-related code, began to write in C # under Win, but later found that the calculation is very large, want to run to the Linux server, testing a bit of mono, the efficiency of some discounts, there is no way, may need to rewrite the use of C + +.

Check some information, found Armadillo This library is very good to start, so began to toss the trip. Code has read HDF5 file requirements, Linux and Mac are good to do, loaded HDF5 library, compile ARMADILLO,GCC compile time add-larmadillo on it. Win under the VS2015, get up a little trouble, compile general OK, the problem is on the link, lazy description, directly on the steps.

1. Download Armadillo,http://sourceforge.net/projects/arma/files/armadillo-8.300.3.tar.xz

2. You use 64-bit program, under the Examples/lib_win64 of the compression package have lapack and Blas Library, can be used directly, otherwise in http://ylzhao.blogspot.com.au/2013/10/ blas-lapack-precompiled-binaries-for.html download. Version 32 can run on a 64-bit system, but 64-bit programs will not necessarily be able to run on 32-bit, for the sake of versatility, I downloaded 32 bits.

3. Extract armadillo to a directory, assuming that the E:\armadillo, including folders Armadillo\include subdirectories;

4. Extract Lapack_release_x86.zip to a directory, assuming the E:\lapack, contains 2 DLLs and 2 lib files;

5. Download and install HDF5 to a certain directory, such as D:\Program files\hdf_group\hdf5\1.8.20, including include, Bin, Lib and other subdirectories;

6. Create a vs2015 C + + project to change the configuration options:

(1) Project-->XX Project Properties-->c/c++--> General, additional include directory, add: E:\armadillo\include;d:\program files\hdf_group\hdf5\1.8.20\ Include

(2) Project-->XX Project Properties-->c/c++--> preprocessor, pre processor definition, delete _debug, increase h5_built_as_dynamic_lib;

WIN32; h5_built_as_dynamic_lib;_console;% ( Preprocessordefinitions)

(3) Project-->XX Project Properties-->c/c++--> code generation, runtime, instead: multithreaded dll (/MD)

(4) Project-->XX Project Properties--> linker--> General, additional library directory, add: E:\lapack;d:\program files\hdf_group\hdf5\1.8.20\include\lib

(5) Project-->XX Project Properties--> linker--> Input, additional dependencies, add: Szip.lib;zlib.lib;hdf5.lib;hdf5_cpp.lib;lapack_win32_mt.lib;blas_ Win32_mt.lib in fact, also not all need to see code requirements, there are generally not wrong;

(6) Modify the e:\armadillo\include\armadillo_bits\config.hpp file, remove #define ARMA_USE_HDF5 before the comment.

(7) Simple test code:

#include <iostream>
#include <armadillo>
#include "hdf5.h"

using namespace Std;
using namespace Arma;

int main ()
{
Mat Mat;
string filename = "File.h5";
Mat.load (hdf5_name (filename));
Mat.print ("Mat");
return 0;
}


Here FILE.H5 documents are prepared in advance H5 documents;

(8) The solution may be an error, open the project's debug directory, that is, exe file generation directory, put the following files:

Blas_win32_mt.dll

Lapack_win32_mt.dll

Hdf5.dll

Szip.dll

Zip.dll

Hdf5_cpp.dll

And then run, the test passes after the above operation.

Related Keywords:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.