In non-CMake uses, the "H5_BUILT_AS_DYNAMIC_LIB" define must be declared.
A Note about this should be in INSTALL_WINDOWS.txt or USING_HDF5_VS.txt - 
HOWEVER this note might have been omitted in the last release docs, it is in 
the next release. This define is automatically handled using CMake.

Allen


On Thursday, January 14, 2016 03:11:53 PM Stig Hornang wrote:
> I'm trying to compile  the following (main.cpp):
> 
> #include "H5Cpp.h"
> 
> using namespace H5;
> 
> int main (void)
> {
>      H5File file("test.h5", H5F_ACC_TRUNC);
> }
> 
> The H5File constructor used here has the following signature:
> 
> H5File(const char* name, unsigned int flags, const FileCreatPropList&
> create_plist = FileCreatPropList::DEFAULT, const FileAccPropList&
> access_plist = FileAccPropList::DEFAULT);
> 
> ...so it as two additional default parameters. I get undefined
> reference when the linker is trying to resolve those:
> 
> main.obj : error LNK2019: unresolved external symbol "public: static
> class H5::FileAccPropList const & const H5::FileAccPropList::DEFAULT"
> (?DEFAULT@FileAccPropList@H5@@2ABV12@B) referenced in function _main
> 
> main.obj : error LNK2019: unresolved external symbol "public: static
> class H5::FileCreatPropList const & const
> H5::FileCreatPropList::DEFAULT"
> (?DEFAULT@FileCreatPropList@H5@@2ABV12@B) referenced in function
> 
> I'm using QtCreator since I'm going to use the library in a Qt
> application. The .pro file for QtCreator is as follows:
> 
> TARGET = hdf5_test
> TEMPLATE = app
> SOURCES += main.cpp
> INCLUDEPATH += "C:/Program Files (x86)/HDF_Group/HDF5/1.8.16/include"
> LIBS += -L"C:/Program Files (x86)/HDF_Group/HDF5/1.8.16/lib/" -lhdf5
> -lhdf5_cpp
> 
> - I'm linking against the shared library version
> - I have no preprocessor directives defined
> - I'm using the contents of this installer: HDF5-1.8.16-win32.msi
> 
> Can someone provide me with a working C++ example for this latest library?
> 
> Since I'm not using CMake, what is useful for me in an example is:
> code, include path, library path, preprocessor defines and possibly
> compiler switcher.
> 
> Is one option to use the static versions instead? If so how can I
> debug my application if only release builds are available? (Cannot mix
> release and debug binaries).
> 
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> Hdf-forum@lists.hdfgroup.org
> http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
> Twitter: https://twitter.com/hdf5


_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to