1

I just downloaded HDF5 for c++ and cannot even create or load files. I'm getting this error:

Undefined symbols for architecture x86_64:
  "_H5check_version", referenced from:
      _main in h5test-764e20.o
  "_H5open", referenced from:
      _main in h5test-764e20.o
  "H5::FileAccPropList::DEFAULT", referenced from:
      _main in h5test-764e20.o
  "H5::FileCreatPropList::DEFAULT", referenced from:
      _main in h5test-764e20.o
  "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 h5test-764e20.o
  "H5::H5File::~H5File()", referenced from:
      _main in h5test-764e20.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [h5test.x] Error 1

Here is my code:

#include <iostream>
#include "H5Cpp.h"

using namespace H5;

int main(){

  const H5std_string FILE_NAME("data/new.hdf5");
  H5File file(FILE_NAME,H5F_ACC_EXCL);

  return 0;
}

Any help would be greatly appreciated.

anazario
  • 21
  • 3
  • Probably main.cpp is being compiled before H5Cpp lib. Checkout make or cmakelist file. – msg Dec 23 '21 at 23:44
  • This should not have been closed. The "duplicate" is extremely generic in comparison. – Whir Jan 03 '22 at 19:29

0 Answers0