Unresolved symbols building C code with Windows makefile


#1

I am getting unresolved symbols for HDF5 functions building C code with Windows nmake. Here is the makefile

ExeName = TestDriver.exe
DirSrc = fdsimGncWrapper
H5Include = “C:\Program Files (x86)\HDF_Group\HDF5\HDF5-1.10.5-vs2013-win32\include”
H5LibPath = “C:\Program Files (x86)\HDF_Group\HDF5\HDF5-1.10.5-vs2013-win32\lib”
H5Libs = libhdf5_D.lib libhdf5_cpp_D.lib libzlib_D.lib libszip_D.lib
CFlags = -DMODEL=EdlGncWrapperAC -DNUMST=3 -DNCSTATES=6 -DHAVESTDIO -DONESTEPFCN=0 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -DPORTABLE_WORDSIZES

$(ExeName): Driver_HDF5C.c $(DirSrc)/.c
cl $(CFlags) -I$(DirSrc) -I$(H5Include) /Fe$(ExeName) Driver_HDF5C.c $(DirSrc)/.c /link /LIBPATH:$(H5LibPath) $(H5Libs)

The source files compile and the link output starts with\

Microsoft ® Incremental Linker Version 12.00.40629.0
Copyright © Microsoft Corporation. All rights reserved.

/out:TestDriver.exe
“/LIBPATH:C:\Program Files (x86)\HDF_Group\HDF5\HDF5-1.10.5-vs2013-win32\lib”
libhdf5_D.lib
libhdf5_cpp_D.lib
libzlib_D.lib
libszip_D.lib
fdsimGncWrapperAC_Driver_HDF5C.obj

That’s the path and library names I expect, but the link fails with unresolved symbols for functions those libraries contain

I have also tried this makefile, based on another project (that needs MathWorks libraries for reading/writing mat-files) that works

ExeName = TestDriver.exe
DirSrc = fdsimGncWrapper
H5Include = “C:\Program Files (x86)\HDF_Group\HDF5\HDF5-1.10.5-vs2013-win32\include”
H5LibPath = “C:\Program Files (x86)\HDF_Group\HDF5\HDF5-1.10.5-vs2013-win32\lib”
H5Libs = libhdf5_D.lib libhdf5_cpp_D.lib libzlib_D.lib libszip_D.lib
CFlags = -DMODEL=EdlGncWrapperAC -DNUMST=3 -DNCSTATES=6 -DHAVESTDIO -DONESTEPFCN=0 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -DPORTABLE_WORDSIZES

$(ExeName): Driver_HDF5C.c $(DirSrc)/.c
cl $(CFlags) -I$(DirSrc) -I$(H5Include)
“C:\Program Files (x86)\HDF_Group\HDF5\HDF5-1.10.5-vs2013-win32\lib\libhdf5_D.lib”
“C:\Program Files (x86)\HDF_Group\HDF5\HDF5-1.10.5-vs2013-win32\lib\libhdf5_cpp_D.lib”
“C:\Program Files (x86)\HDF_Group\HDF5\HDF5-1.10.5-vs2013-win32\lib\libzlib_D.lib”
“C:\Program Files (x86)\HDF_Group\HDF5\HDF5-1.10.5-vs2013-win32\lib\libszip_D.lib”
/Fe$(ExeName) Driver_HDF5C.c $(DirSrc)/.c

Again, the source files compile and the linker output message lists the libraries, but it also fails with unresolved symbols

Any suggestions?