I have the files: main.cpp, tools.cpp, tools.h, integrator.cpp, and integrator.h.
I have tried to link HDF5 to this code (it compiles/links just fine without hdf5 stuff).
Here's what I am using to compile:
g -Wall -Werror -pedantic -std=c 1y -I /usr/local/include -L/usr/local/lib -lhdf5 -lhdf5_hl -lhdf5_cpp main.cpp tools.cpp integrator.cpp
The error I get is complete nonsense to me:
"__ZN2H56H5FileC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEjRKNS_17FileCreatPropListERKNS_15FileAccPropListE", referenced from:
_main in cc76aLiD.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
However, sure enough, if I take out all the HDF5 commands in my code but keep the #include "H5Cpp.h"
at the top of main.cpp it works. This seems odd to me because I would assume it would fail here too?
Anyone have any suggestions to try? I'm using a Mac if that is relevant. Thanks!
CodePudding user response:
Maybe you want also link with -lhdf5_hl_cpp
. If you had used cmake, as I suggested today, you would not have such issues.