Dear all,

I have the following question. I have compiled and installed hdf5-1.8.11 on my 
mac (Darwin Kernel Version 12.3.0, clang-4.2 ) and I want to link a c++11 
application to hdf5. As a test example I am compiling create.cpp from 
http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/c++/examples/create.cpp

Everything goes smoothly, when no c++11 is required - that is 

clang++  -I/usr/local/include/ ../create.cpp -L/usr/local/lib -lsz -lz -ldl -lm 
-lhdf5 -lhdf5_cpp -lhdf5_hl -lhdf5_hl_cpp

Once I now want to switch the c++11 support of clang I run 

clang++ -std=c++11 -stdlib=libc++ -I/usr/local/include/ ../create.cpp 
-L/usr/local/lib -lsz -lz -ldl -lm -lhdf5 -lhdf5_cpp -lhdf5_hl -lhdf5_hl_cpp

which gives

Undefined symbols for architecture x86_64:
  "H5::H5File::H5File(std::__1::basic_string<char, std::__1::char_traits<char>, 
std::__1::allocator<char> > const&, unsigned int, H5::FileCreatPropList const&, 
H5::FileAccPropList const&)", referenced from:
      _main in create-ruwH6L.o
  "H5::CommonFG::createDataSet(std::__1::basic_string<char, 
std::__1::char_traits<char>, std::__1::allocator<char> > const&, H5::DataType 
const&, H5::DataSpace const&, H5::DSetCreatPropList const&) const", referenced 
from:
      _main in create-ruwH6L.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The error comes from H5std_string which is a typedef for std::string in 
H5Exception.h . The std::string has been changed in c++11, and hdf5 is compiled 
without hdf5 support and so uses old c++-03 string. 

Is there any workaround for this?

Best regards,
Andrey.
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Reply via email to