Can not link to dynamic hdf5 library on Visual Studio 2005

Hi,

I have trouble to link to dynamic hdf5 library on Visual Studio 2005. The
same error happens for hdf5 1.6.7 and 1.8.1. I am using the binary HDF5
library downloaded from hdfgroup web site. If I link my app with static
hdf5.lib, then it works fine.

Can somebody help me?

Thank you,

Grant

------ Build started: Project: qindex, Configuration: Release Win32 ------

Linking...

   Creating library C:\EMAN\build\bin\Release\qindex.lib and object
C:\EMAN\build\bin\Release\qindex.exp

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5P_CLS_FILE_ACCESS_g referenced in function "public: static int __cdecl
EMhdf2::init_test(char const *)" (?init_test@EMhdf2@@SAHPBD@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_NATIVE_FLOAT_g referenced in function "public: int __thiscall
EMhdf2::read_data(float *,int)" (?read_data@EMhdf2@@QAEHPAMH@Z)

EM.lib(EMhdf.obj) : error LNK2001: unresolved external symbol
_H5T_NATIVE_FLOAT_g

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_NATIVE_DOUBLE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)" (?write_attr@EMhdf2
@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_NATIVE_INT_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)" (?write_attr@EMhdf2
@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf.obj) : error LNK2001: unresolved external symbol
_H5T_NATIVE_INT_g

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol _H5T_C_S1_g
referenced in function "private: int __thiscall EMhdf2::write_attr(int,char
const *,class EMObject)" (?write_attr@EMhdf2@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf.obj) : error LNK2001: unresolved external symbol _H5T_C_S1_g

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_IEEE_F64LE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)" (?write_attr@EMhdf2
@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_IEEE_F32LE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)" (?write_attr@EMhdf2
@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_STD_I32LE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)" (?write_attr@EMhdf2
@@AAEHHPBDVEMObject@@@Z)

C:\EMAN\build\bin\Release\qindex.exe : fatal error LNK1120: 8 unresolved
externals

Build log was saved at
"file://c:\EMAN\build\qindex\qindex.dir\Release\BuildLog.htm"

qindex - 12 error(s), 0 warning(s)

Grant,

Here are my project settings (.Net 2003, HDF 1.8.0, local build): 1) Under
"C/C++.Preprocessor", define HDF5CPP_USEDLL; 2) under
"Linker.General.Additional Library Directories" include the location of your
HDF5 import LIBs (.lib), e.g. "./hdf5/hdf5lib/release/dll"; and 3) under
"Linker.Input.Additional Dependencies" add hdf5dll.lib and hdf5_cppdll.lib"
for the C and C++ import libraries. Also, make sure that the location of
the DLLs (in this case "./hdf5/hdf5lib/release/dll" is in your PATH so the
EXE can load them at runtime.

I built the 1.8.0 libraries in-house on .Net 2003, so there may be some
differences. Also not sure of the pathname structure on the pre-built
installations. From the looks of things, though, you're just not finding
the import .lib files.

Robert Seip

For the debug version, it would be "./hdf5/hdf5lib/debug/dll" and
"hdf5ddll.lib and hdf5_cppddll.lib". Note the extra 'd'.

···

-----Original Message-----
From: Grant Tang [mailto:grant.tang@gmail.com]
Sent: Wednesday, July 16, 2008 3:28 PM
To: hdf forum
Subject: [hdf-forum] Can not link to dynamic hdf5 library on Visual Studio
2005

Hi,

I have trouble to link to dynamic hdf5 library on Visual Studio 2005. The
same error happens for hdf5 1.6.7 and 1.8.1. I am using the binary HDF5
library downloaded from hdfgroup web site. If I link my app with static
hdf5.lib, then it works fine.

Can somebody help me?

Thank you,

Grant

------ Build started: Project: qindex, Configuration: Release Win32 ------

Linking...

   Creating library C:\EMAN\build\bin\Release\qindex.lib and object
C:\EMAN\build\bin\Release\qindex.exp

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5P_CLS_FILE_ACCESS_g referenced in function "public: static int __cdecl
EMhdf2::init_test(char const *)" (?init_test@EMhdf2@@SAHPBD@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_NATIVE_FLOAT_g referenced in function "public: int __thiscall
EMhdf2::read_data(float *,int)" (?read_data@EMhdf2@@QAEHPAMH@Z)

EM.lib(EMhdf.obj) : error LNK2001: unresolved external symbol
_H5T_NATIVE_FLOAT_g

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_NATIVE_DOUBLE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)"
(?write_attr@EMhdf2@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_NATIVE_INT_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)"
(?write_attr@EMhdf2@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf.obj) : error LNK2001: unresolved external symbol
_H5T_NATIVE_INT_g

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol _H5T_C_S1_g
referenced in function "private: int __thiscall EMhdf2::write_attr(int,char
const *,class EMObject)" (?write_attr@EMhdf2@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf.obj) : error LNK2001: unresolved external symbol _H5T_C_S1_g

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_IEEE_F64LE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)"
(?write_attr@EMhdf2@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_IEEE_F32LE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)"
(?write_attr@EMhdf2@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_STD_I32LE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)"
(?write_attr@EMhdf2@@AAEHHPBDVEMObject@@@Z)

C:\EMAN\build\bin\Release\qindex.exe : fatal error LNK1120: 8 unresolved
externals

Build log was saved at
"file://c:\EMAN\build\qindex\qindex.dir\Release\BuildLog.htm"

qindex - 12 error(s), 0 warning(s)

Robert:

Thanks for your reply. I am not using hdf5 cpp, I need to define
_HDF5USEDLL_ in the preprocessor which is suggestted by Scott. Apparently,
for dynamic HDF5 library linking, we need define extra definition.

Cheers,
Grant

···

On Thu, Jul 17, 2008 at 1:57 PM, Robert Seip <rhs@sharqblot.com> wrote:

Grant,

Here are my project settings (.Net 2003, HDF 1.8.0, local build): 1) Under
"C/C++.Preprocessor", define HDF5CPP_USEDLL; 2) under
"Linker.General.Additional Library Directories" include the location of your
HDF5 import LIBs (.lib), e.g. "…/hdf5/hdf5lib/release/dll"; and 3) under
"Linker.Input.Additional Dependencies" add hdf5dll.lib and hdf5_cppdll.lib"
for the C and C++ import libraries. Also, make sure that the location of
the DLLs (in this case "…/hdf5/hdf5lib/release/dll" is in your PATH so the
EXE can load them at runtime.

I built the 1.8.0 libraries in-house on .Net 2003, so there may be some
differences. Also not sure of the pathname structure on the pre-built
installations. From the looks of things, though, you're just not finding
the import .lib files.

Robert Seip

For the debug version, it would be "…/hdf5/hdf5lib/debug/dll" and
"hdf5ddll.lib and hdf5_cppddll.lib". Note the extra 'd'.

-----Original Message-----
*From:* Grant Tang [mailto:grant.tang@gmail.com]
*Sent:* Wednesday, July 16, 2008 3:28 PM
*To:* hdf forum
*Subject:* [hdf-forum] Can not link to dynamic hdf5 library on Visual
Studio 2005

Hi,

I have trouble to link to dynamic hdf5 library on Visual Studio 2005. The
same error happens for hdf5 1.6.7 and 1.8.1. I am using the binary HDF5
library downloaded from hdfgroup web site. If I link my app with static
hdf5.lib, then it works fine.

Can somebody help me?

Thank you,

Grant

------ Build started: Project: qindex, Configuration: Release Win32 ------

Linking...

   Creating library C:\EMAN\build\bin\Release\qindex.lib and object
C:\EMAN\build\bin\Release\qindex.exp

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5P_CLS_FILE_ACCESS_g referenced in function "public: static int __cdecl
EMhdf2::init_test(char const *)" (?init_test@EMhdf2@@SAHPBD@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_NATIVE_FLOAT_g referenced in function "public: int __thiscall
EMhdf2::read_data(float *,int)" (?read_data@EMhdf2@@QAEHPAMH@Z)

EM.lib(EMhdf.obj) : error LNK2001: unresolved external symbol
_H5T_NATIVE_FLOAT_g

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_NATIVE_DOUBLE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)" (?write_attr@EMhdf2
@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_NATIVE_INT_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)" (?write_attr@EMhdf2
@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf.obj) : error LNK2001: unresolved external symbol
_H5T_NATIVE_INT_g

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol _H5T_C_S1_g
referenced in function "private: int __thiscall EMhdf2::write_attr(int,char
const *,class EMObject)" (?write_attr@EMhdf2@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf.obj) : error LNK2001: unresolved external symbol _H5T_C_S1_g

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_IEEE_F64LE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)" (?write_attr@EMhdf2
@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_IEEE_F32LE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)" (?write_attr@EMhdf2
@@AAEHHPBDVEMObject@@@Z)

EM.lib(EMhdf2.obj) : error LNK2019: unresolved external symbol
_H5T_STD_I32LE_g referenced in function "private: int __thiscall
EMhdf2::write_attr(int,char const *,class EMObject)" (?write_attr@EMhdf2
@@AAEHHPBDVEMObject@@@Z)

C:\EMAN\build\bin\Release\qindex.exe : fatal error LNK1120: 8 unresolved
externals

Build log was saved at
"file://c:\EMAN\build\qindex\qindex.dir\Release\BuildLog.htm"

qindex - 12 error(s), 0 warning(s)

--
Grant Tang