HDF4 compile on mingw/msys problems

Dear all,
I'm struggling compiling hdf4 libraries under windows seven 32bit with
mingw/msys toolchain. I'm on a Windows 7 32bit.
I'm not very familiar with cmake stuff so I might have done things in
the bad way.
I'm neither familiar with windows linking libraries and stuff like that...

I finally got it right and compiled (I had to drop fortran though...)
but in a very dirty way

Many thanks to those who will read this 'till the end and help me find
the clue!

Anyway,
I have jpeg and libz installed via GnuWin32 under /c/compile/GnuWin32

I can get the config right with the command (in the msys shell)
/c/Program\ Files/CMake/bin/cmake -G "MSYS Makefiles"
-DCMAKE_PREFIX_PATH=/c/compile/GnuWin32
-DCMAKE_INSTALL_PREFIX=/c/compile/GnuWin32 -DBUILD_SHARED_LIBS=ON
-DHDF4_BUILD_FORTRAN=OFF ../hdf-4.2.10

but then I get 3 main issues:

--------------------- 1st issue ---------------------
to avoid the error below I have to fix the CMakeLists.txt changing the line
$ diff ../hdf-4.2.10/CMakeLists.txt /F/Downloads/hdf-4.2.10/CMakeLists.txt
376c376
< SET (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}
-std=gnu99 -finline-functions -fno-common")

···

---

    SET (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99

-finline-functions -fno-common")
378c378
< SET (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}
-std=gnu99 -fomit-frame-pointer -finline-functions -fno-common")
---

    SET (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99

-fomit-frame-pointer -finline-functions -fno-common")

$ make
Scanning dependencies of target xdr
[ 1%] Building C object xdr/CMakeFiles/xdr.dir/xdr.c.obj
In file included from c:\mingw\include\fcntl.h:37:0,
                 from C:/compile/hdf-4.2.10/hdf/src/hdfi.h:586,
                 from C:/compile/hdf-4.2.10/hdf/src/hdf.h:20,
                 from c:/compile/hdf-4.2.10/mfhdf/xdr/xdr.h:251,
                 from c:/compile/hdf-4.2.10/mfhdf/xdr/xdr.c:19:
c:\mingw\include\io.h:301:1: error: unknown type name 'off64_t'
__CRT_INLINE off64_t lseek64 (int, off64_t, int);
^
c:\mingw\include\io.h:301:36: error: unknown type name 'off64_t'
__CRT_INLINE off64_t lseek64 (int, off64_t, int);
                                    ^
c:\mingw\include\io.h:302:1: error: unknown type name 'off64_t'
__CRT_INLINE off64_t lseek64 (int fd, off64_t offset, int whence) {
^
c:\mingw\include\io.h:302:39: error: unknown type name 'off64_t'
__CRT_INLINE off64_t lseek64 (int fd, off64_t offset, int whence) {
                                       ^
c:/compile/hdf-4.2.10/mfhdf/xdr/xdr.c: In function 'xdr_opaque':
c:/compile/hdf-4.2.10/mfhdf/xdr/xdr.c:309:9: warning: type defaults to
'int' in declaration of 'crud' [enabled by default]
  static crud[BYTES_PER_XDR_UNIT];
         ^
make[2]: *** [xdr/CMakeFiles/xdr.dir/xdr.c.obj] Error 1
make[1]: *** [xdr/CMakeFiles/xdr.dir/all] Error 2
make: *** [all] Error 2

--------------------- 2nd issue ---------------------
Then at the final linking it complains about missing the lib ws2_32 so I
added the line (similar to the case of MSVC):
$ diff ../hdf-4.2.10/mfhdf/xdr/CMakeLists.txt
/F/Downloads/hdf-4.2.10/mfhdf/xdr/CMakeLists.txt
30d29
< TARGET_LINK_LIBRARIES (${HDF4_MF_XDR_LIB_TARGET} "ws2_32.lib")

--------------------- 3rd issue ---------------------
I had to finish "by hand" the final linking to get the mfhdf.dll done !
here is the line I used
/c/MinGW/bin/gcc.exe -shared -o ../../bin/mfhdf.dll
-Wl,--out-implib,../../bin/mfhdf.lib
-Wl,--major-image-version,4,--minor-image-version,2 -Wl,--whole-archive
CMakeFiles/mfhdf.dir/objects.a -Wl,--no-whole-archive -L../../bin -lxdr
-lhdf -lws2_32 /C/compile/GnuWin32/lib/libjpeg.dll.a
/C/compile/GnuWin32/lib/libz.dll.a -lkernel32 -luser32 -lgdi32
-lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

compared to the cmake one (I replaced ../../bin/xdr.lib
../../bin/hdf.lib with-L../../bin -lxdr -lhdf ):
/c/MinGW/bin/gcc.exe -shared -o ../../bin/mfhdf.dll
-Wl,--out-implib,../../bin/mfhdf.lib
-Wl,--major-image-version,4,--minor-image-version,2 -Wl,--whole-archive
CMakeFiles/mfhdf.dir/objects.a -Wl,--no-whole-archive ../../bin/xdr.lib
../../bin/hdf.lib -lws2_32 /c/compile/GnuWin32/lib/libjpeg.dll.a
/c/compile/GnuWin32/lib/libz.dll.a -lkernel32 -luser32 -lgdi32
-lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

Otherwise I get a bunch of errors like:

cd /C/compile/hdf4-new/mfhdf/libsrc && /c/MinGW/bin/gcc.exe -shared
-o ../../bin/mfhdf.dll -Wl,--out-implib,../../
bin/mfhdf.lib -Wl,--major-image-version,4,--minor-image-version,2
-Wl,--whole-archive CMakeFiles/mfhdf.dir/objects.a -Wl
,--no-whole-archive ../../bin/xdr.lib ../../bin/hdf.lib -lws2_32
/c/compile/GnuWin32/lib/libjpeg.dll.a /c/compile/GnuWin
32/lib/libz.dll.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32
-lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x112): undefined
reference to `Vfinish'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x133): undefined
reference to `Hclose'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1da): undefined
reference to `HEpush'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x235): undefined
reference to `HEpush'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x374): undefined
reference to `HEpush'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x511): undefined
reference to `Hishdf'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x6d5): undefined
reference to `Hishdf'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x741): undefined
reference to `Hopen'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x775): undefined
reference to `Vinitialize'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x83e): undefined
reference to `HEpush'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1044):
undefined reference to `VHstoredata'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1100):
undefined reference to `HEpush'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x11a3):
undefined reference to `VHstoredata'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x129d):
undefined reference to `VHstoredatam'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x14cd):
undefined reference to `VHmakegroup'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1717):
undefined reference to `VSattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1752):
undefined reference to `VSsetclass'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x178e):
undefined reference to `VSfdefine'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x17ba):
undefined reference to `VSsetfields'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x17de):
undefined reference to `VSQueryref'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x17f5):
undefined reference to `VSdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1890):
undefined reference to `DFKgetPNSC'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x18cf):
undefined reference to `Hnewref'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1953):
undefined reference to `Hputelement'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x19a1):
undefined reference to `DFdisetup'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x19ff):
undefined reference to `DFdiput'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1a37):
undefined reference to `DFdiput'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1c54):
undefined reference to `Hputelement'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1c8c):
undefined reference to `DFdiput'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1ce1):
undefined reference to `DFdiput'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1d32):
undefined reference to `DFdiwrite'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x1dbf):
undefined reference to `VHmakegroup'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x23f6):
undefined reference to `VHmakegroup'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2549):
undefined reference to `Hlength'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x25e2):
undefined reference to `Hgetelement'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2673):
undefined reference to `Hputelement'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2794):
undefined reference to `Vntagrefs'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x27e2):
undefined reference to `Visvg'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2812):
undefined reference to `Vattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x283f):
undefined reference to `Vgetclass'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x28c0):
undefined reference to `Vinquire'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x28ff):
undefined reference to `Visvs'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x292f):
undefined reference to `VSattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x296a):
undefined reference to `VSgetclass'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x29f4):
undefined reference to `VSinquire'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2a57):
undefined reference to `VSseek'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2a93):
undefined reference to `VSread'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2b1b):
undefined reference to `VSdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2cf5):
undefined reference to `Vgetnext'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2d19):
undefined reference to `Vdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2d48):
undefined reference to `Vgetnext'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2e83):
undefined reference to `Vntagrefs'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2ee4):
undefined reference to `Vgettagref'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2f33):
undefined reference to `VSattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2f6b):
undefined reference to `VSgetclass'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x2fac):
undefined reference to `VSdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x30b1):
undefined reference to `Vntagrefs'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3153):
undefined reference to `Vgettagref'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x31a2):
undefined reference to `VSattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x31da):
undefined reference to `VSgetclass'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x324e):
undefined reference to `VSinquire'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x327a):
undefined reference to `VFfieldtype'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3324):
undefined reference to `VSsetfields'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3366):
undefined reference to `VSread'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x339c):
undefined reference to `VFfieldorder'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x349f):
undefined reference to `VSdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x366b):
undefined reference to `Vntagrefs'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x36a9):
undefined reference to `Vntagrefs'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x36e7):
undefined reference to `Vntagrefs'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x373b):
undefined reference to `Vgettagref'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x378a):
undefined reference to `Vattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x37a9):
undefined reference to `Vgetclass'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x383a):
undefined reference to `Vinquire'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x38c0):
undefined reference to `Vgettagref'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3951):
undefined reference to `Vattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3978):
undefined reference to `Vgetclass'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3a02):
undefined reference to `Vinquire'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3a89):
undefined reference to `Vdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3acb):
undefined reference to `VSattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3af5):
undefined reference to `VSgetclass'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3b6d):
undefined reference to `VSdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3bd3):
undefined reference to `Hlength'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3c2e):
undefined reference to `Hgetelement'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3cda):
undefined reference to `DFKgetPNSC'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x3f90):
undefined reference to `Vdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x40c1):
undefined reference to `Vfindclass'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x40e8):
undefined reference to `Vattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4113):
undefined reference to `HEpush'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x41f0):
undefined reference to `Vdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4212):
undefined reference to `Vdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4308):
undefined reference to `HEpush'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4378):
undefined reference to `Vattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x439c):
undefined reference to `Vntagrefs'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x43e5):
undefined reference to `Vgettagref'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4436):
undefined reference to `vexistvg'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4483):
undefined reference to `vexistvs'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x44a2):
undefined reference to `VSdelete'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x44e1):
undefined reference to `Hdeldd'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4512):
undefined reference to `Vdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x458a):
undefined reference to `Vattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x45ae):
undefined reference to `Vntagrefs'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x45f7):
undefined reference to `Vgettagref'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4631):
undefined reference to `vexistvg'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4676):
undefined reference to `Vdelete'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x46aa):
undefined reference to `VSdelete'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x46ec):
undefined reference to `Hdeldd'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4721):
undefined reference to `Vdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4750):
undefined reference to `Vdelete'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4845):
undefined reference to `Hendaccess'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x48df):
undefined reference to `Vattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x491f):
undefined reference to `Visvg'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x494f):
undefined reference to `Vattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4987):
undefined reference to `Vgetclass'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x49e2):
undefined reference to `Visvs'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4a12):
undefined reference to `VSattach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4a4a):
undefined reference to `VSgetclass'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4abb):
undefined reference to `VSsetfields'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4ae7):
undefined reference to `VSseek'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4b23):
undefined reference to `VSwrite'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4b48):
undefined reference to `VSdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4b77):
undefined reference to `Vgetnext'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4b9b):
undefined reference to `Vdetach'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4bea):
undefined reference to `Vgetnext'
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj):cdf.c:(.text+0x4c0e):
undefined reference to `Vdetach'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe:
CMakeFiles/mfhdf.dir/objects.a(cdf.c.obj): bad rel
oc address 0x0 in section `.data'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [bin/mfhdf.dll] Error 1
make[2]: Leaving directory `/c/compile/hdf4-new'
make[1]: *** [mfhdf/libsrc/CMakeFiles/mfhdf.dir/all] Error 2
make[1]: Leaving directory `/c/compile/hdf4-new'
make: *** [all] Error 2

What Im I doing wrong?

many thanks

Tommaso