Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

header file #1

Closed
mohammadp1001 opened this issue Apr 4, 2014 · 10 comments
Closed

header file #1

mohammadp1001 opened this issue Apr 4, 2014 · 10 comments

Comments

@mohammadp1001
Copy link

How can I use these .hpp files with g++ compiler ?

@garrison
Copy link
Owner

garrison commented Apr 4, 2014

There are examples at https://github.com/garrison/eigen3-hdf5#api

Do you have a more specific question or issue?

@mohammadp1001
Copy link
Author

Yes, I saw them but when I try compile my code with g++ my compiler could not recognize .hpp header files .
Could you help me ?

@garrison
Copy link
Owner

garrison commented Apr 4, 2014

Did you include the directory containing eigen3-hdf5? Typically I run something like

g++ -I/path/to/eigen3-hdf5 -o programname programname.cpp

@mohammadp1001
Copy link
Author

I think it works for sparse matrix under some especial circumstance .
I got this error :
error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

@garrison
Copy link
Owner

garrison commented Apr 4, 2014

Oh yes, I also use the -std=c++11 flag.

@mohammadp1001
Copy link
Author

Unfortunately I got new errors , do you have idea about it ?

In file included from /home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5-sparse.hpp:6:0,
from sparse_matrix_.cpp:13:
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:222:35: error: ‘H5Location’ in namespace ‘H5’ does not name a type
void save_scalar_attribute (const H5::H5Location &h5obj, const std::string &name, const T &value)
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:222:51: error: ISO C++ forbids declaration of ‘h5obj’ with no type [-fpermissive]
void save_scalar_attribute (const H5::H5Location &h5obj, const std::string &name, const T &value)
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp: In function ‘void EigenHDF5::save_scalar_attribute(const int&, const string&, const T&)’:
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:226:31: error: request for member ‘createAttribute’ in ‘h5obj’, which is of non-class type ‘const int’
H5::Attribute att = h5obj.createAttribute(name, *datatype, dataspace);
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp: At global scope:
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:231:42: error: ‘H5Location’ in namespace ‘H5’ does not name a type
inline void save_scalar_attribute (const H5::H5Location &h5obj, const std::string &name, const std::string &value)
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:231:58: error: ISO C++ forbids declaration of ‘h5obj’ with no type [-fpermissive]
inline void save_scalar_attribute (const H5::H5Location &h5obj, const std::string &name, const std::string &value)
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:250:28: error: ‘H5Location’ in namespace ‘H5’ does not name a type
void save_attribute (const H5::H5Location &h5obj, const std::string &name, const Eigen::EigenBase &mat)
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:250:44: error: ISO C++ forbids declaration of ‘h5obj’ with no type [-fpermissive]
void save_attribute (const H5::H5Location &h5obj, const std::string &name, const Eigen::EigenBase &mat)
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp: In function ‘void EigenHDF5::save_attribute(const int&, const string&, const Eigen::EigenBase&)’:
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:256:35: error: request for member ‘createAttribute’ in ‘h5obj’, which is of non-class type ‘const int’
H5::Attribute dataset = h5obj.createAttribute(name, *datatype, dataspace);
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp: At global scope:
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:311:28: error: ‘H5Location’ in namespace ‘H5’ does not name a type
void load_attribute (const H5::H5Location &h5obj, const std::string &name, const Eigen::DenseBase &mat)
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:311:44: error: ISO C++ forbids declaration of ‘h5obj’ with no type [-fpermissive]
void load_attribute (const H5::H5Location &h5obj, const std::string &name, const Eigen::DenseBase &mat)
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp: In function ‘void EigenHDF5::load_attribute(const int&, const string&, const Eigen::DenseBase&)’:
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:313:41: error: request for member ‘openAttribute’ in ‘h5obj’, which is of non-class type ‘const int’
const H5::Attribute dataset = h5obj.openAttribute(name);
^
In file included from sparse_matrix_.cpp:13:0:
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5-sparse.hpp: In instantiation of ‘void EigenHDF5::load_sparse(const H5::CommonFG&, const string&, SparseMatrixType&) [with SparseMatrixType = Eigen::SparseMatrix<long int, 1>; std::string = std::basic_string]’:
sparse_matrix_.cpp:70:49: required from here
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5-sparse.hpp:91:43: error: no matching function for call to ‘load_attribute(const H5::DataSet&, const char [6], Eigen::Matrix<int, 2, 1>&)’
load_attribute(dataset, "shape", shape);
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5-sparse.hpp:91:43: note: candidate is:
In file included from /home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5-sparse.hpp:6:0,
from sparse_matrix_.cpp:13:
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:311:6: note: template void EigenHDF5::load_attribute(const int&, const string&, const Eigen::DenseBase&)
void load_attribute (const H5::H5Location &h5obj, const std::string &name, const Eigen::DenseBase &mat)
^
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5.hpp:311:6: note: template argument deduction/substitution failed:
In file included from sparse_matrix_.cpp:13:0:
/home/mohammad/Documents/eigen3-hdf5/eigen3-hdf5-sparse.hpp:91:43: note: cannot convert ‘dataset’ (type ‘const H5::DataSet’) to type ‘const int&’
load_attribute(dataset, "shape", shape);
^

@garrison
Copy link
Owner

garrison commented Apr 4, 2014

Are you using version 1.8.12 or higher of the HDF5 C++ library?

@mohammadp1001
Copy link
Author

yes, it is 1.8.12

@mohammadp1001
Copy link
Author

Sorry , it is 1.8.11

@garrison
Copy link
Owner

garrison commented Apr 4, 2014

If you absolutely must use 1.8.11, try version f85a82b of eigen3-hdf5. This is the last commit before I began requiring 1.8.12.

@garrison garrison closed this as completed Apr 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants