# implement hdf5 in eclipse cdt for a c tool

**URL:** <https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990>\
**Category:** HDF5 Library\
**Created:** [July 19, 2022, 3:53pm UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990 "2022-07-19T15:53:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![s.kraus](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@s.kraus](https://forum.hdfgroup.org/u/s.kraus)\
**Post date:** [July 19, 2022, 3:53pm UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/1 "2022-07-19T15:53:56Z")

</div>

hi i m looking for a good tutrial to include the hdf5 lib in my eclipse cdt toolchain im using mingw32 as compiler and cant find any tutorial which descripes fully how to do it. If i found a link for a tutorial it was anytimes a dead link.  
What i did so far:  
-download and installed hdf5 with the msi installer and tryed to link it in the project under c/c++ build -\> Settings -\>Tool Settings tab -\> Miscellaneous-\>other objects and set “path of install folder”\1.13.1\bin\hdf5.dll

didnt worked console output was  
C:/Program Files/HDF\_Group/HDF5/1.13.1/bin/hdf5.dll: file not recognized: File format not recognized

than i tried to set it in project properties-\> C/C++ General-\> Paths and Symbols under libraries tab i added hdf5.dll (with full path and without) and also i set the path in Library Path

didnt worked console output  
C:/Program Files/HDF\_Group/HDF5/1.13.1/bin/hdf5.dll: file not recognized: File format not recognized

than i tried to download the mingw ackage with the pacman from msys this only worked for 64 bit but i need 32 bit

can someone please please help me like i said any link i found to a tutorial is dead or for vs but need it for eclipse

thanks in advance Sebastian

---

<div class="post-metadata">

**Author:** ![byrn](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@byrn](https://forum.hdfgroup.org/u/byrn)\
**Post date:** [July 19, 2022, 4:06pm UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/2 "2022-07-19T16:06:14Z")

</div>

You will need to build hdf5 as all the download binaries are for 64-bit.

---

<div class="post-metadata">

**Author:** ![german.salazar](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@german.salazar](https://forum.hdfgroup.org/u/german.salazar)\
**Post date:** [July 19, 2022, 7:58pm UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/3 "2022-07-19T19:58:19Z")

</div>

I don’t use Eclipse.  
Historically being a Linux guy, I have started to migrate to Windows using MSYS2 / MinGW64.  
I am curious to know why you need 32-bit, when chances are your Windows client already is 64-bit.

Sorry to hear you use Eclipse. If you learned how to build from the command line, you would only need to learn one thing, once and for all; with IDE’s, you need to read the docs for that particular IDE.

---

<div class="post-metadata">

**Author:** ![s.kraus](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@s.kraus](https://forum.hdfgroup.org/u/s.kraus)\
**Post date:** [July 20, 2022, 7:35am UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/4 "2022-07-20T07:35:12Z")

</div>

weil das Programm auf einen 32 bit system laufen muss deshalb geht meines wissens nach 64 bit nicht. Weißt du denn wie ich mit cmds die lib erstellen kann so das ich sie in mein project erstellen einfügen kann salazar?

---

<div class="post-metadata">

**Author:** ![german.salazar](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@german.salazar](https://forum.hdfgroup.org/u/german.salazar)\
**Post date:** [July 20, 2022, 10:48am UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/5 "2022-07-20T10:48:34Z")

</div>

What happened there?

Don’t let my name mislead you, I am not from Germany and I don’t speak German; I am of Spanish descent and my proper name is Germán (but that accent often does not get included in my e-mail addresses).

Cheers

---

<div class="post-metadata">

**Author:** ![s.kraus](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@s.kraus](https://forum.hdfgroup.org/u/s.kraus)\
**Post date:** [July 20, 2022, 11:18am UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/6 "2022-07-20T11:18:32Z")

</div>

ah sorry my mistake so in englisch again i need to do it in 32 bit bc the target system is just 32 bit. i tried to follow this tutorial [GitHub - long-gong/HDF5-with-MinGW: Play HDF5 with MinGW on Windows 10](https://github.com/long-gong/HDF5-with-MinGW) found a error in the cmd:  
cmake -G “MinGW Makefiles” -DCMAKE\_BUILD\_TYPE:STRING=Release -DHDF5\_BUILD\_FORTRAN:BOOL=OFF -DHDF5\_BUILD\_JAVA:BOOL=OFF -DCMAKE\_INSTALL\_PREFIX:PATH=\path\to\install\HDF5 DHDF5\_ENABLE\_SZIP\_SUPPORT:BOOL=OFF -DHDF5\_ENABLE\_Z\_LIB\_SUPPORT:BOOL=OFF -DBUILD\_TESTING:BOOL=ON -DHDF5\_BUILD\_TOOLS:BOOL=ON …\hdf5-1.10.5

where a “-” is missing so corrected it is :  
cmake -G “MinGW Makefiles” -DCMAKE\_BUILD\_TYPE:STRING=Release -DHDF5\_BUILD\_FORTRAN:BOOL=OFF -DHDF5\_BUILD\_JAVA:BOOL=OFF -DCMAKE\_INSTALL\_PREFIX:PATH=\path\to\install\HDF5 -DHDF5\_ENABLE\_SZIP\_SUPPORT:BOOL=OFF -DHDF5\_ENABLE\_Z\_LIB\_SUPPORT:BOOL=OFF -DBUILD\_TESTING:BOOL=ON -DHDF5\_BUILD\_TOOLS:BOOL=ON …\hdf5-1.10.5  
than i run mingw-make but this throws lot of error which i put in a txt file and attach it here  
[mingw-make-errors.txt](https://hdf-discourse-1.s3.amazonaws.com/original/2X/3/3bf19822afecb7768b4d46fa932a2738fcc7f420.txt) (42.7 KB)  
can u maybe check it and help me

---

<div class="post-metadata">

**Author:** ![german.salazar](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@german.salazar](https://forum.hdfgroup.org/u/german.salazar)\
**Post date:** [July 20, 2022, 11:59am UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/7 "2022-07-20T11:59:46Z")

</div>

I may have time to take a look later.  
I am totally new to hdf5, but I just built it for Linux.  
Also, I am already setup to use MinGW and GCC on my Windows machine.  
We shall see.  
Having said, it does not look like A LOT OF ERRORS; most are warnings and notes, there are only 2 errors.

---

<div class="post-metadata">

**Author:** ![german.salazar](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@german.salazar](https://forum.hdfgroup.org/u/german.salazar)\
**Post date:** [July 21, 2022, 2:35am UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/8 "2022-07-21T02:35:56Z")

</div>

Update: I just realized that you are using cmake…I typically (like never) use cmake.

As a matter of habit, I downloaded the \*.tar file for hdf5 to my Windows machine, opened a bash terminal and simply started to do what I always do: ./configure, make, make install…  
…it is working, but it is taking forever…I am spoiled by the Linux machines, my Windows machine seems to be about 2 orders of magnitude slower than Linux. I am going to let it be; maybe tomorrow I will try with cmake.

---

<div class="post-metadata">

**Author:** ![german.salazar](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@german.salazar](https://forum.hdfgroup.org/u/german.salazar)\
**Post date:** [July 21, 2022, 2:45am UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/9 "2022-07-21T02:45:08Z")

</div>

In the meantime, maybe you should try the ./configure, make, make install route.  
You may start with something like this:

```
$export JAVA_HOME=/c/path/to/java
$export PATH=$JAVA_HOME/bin:$PATH
$./configure --prefix=/c/myprograms/hdf5/1.12.2/win10 \
        --enable-build-mode=production \
        --enable-fortran \
        --enable-cxx \
        --enable-java \
        --enable-shared \
        --enable-tools \
        --with-pic
$make
.
.
.
```

---

<div class="post-metadata">

**Author:** ![s.kraus](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@s.kraus](https://forum.hdfgroup.org/u/s.kraus)\
**Post date:** [July 21, 2022, 8:46am UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/10 "2022-07-21T08:46:35Z")

</div>

changed the cmds to:  
$export PATH=/c/mingw/bin:$PATH  
$ ./configure --prefix=/c/myprograms/hdf5/1.12.2/win10 --enable-build-mode=production --enable-fortran --enable-cxx --enable-shared --enable-tools --with-pic

Output:

SUMMARY OF THE HDF5 CONFIGURATION  
=================================

## General Information:

```
               HDF5 Version: 1.12.2
              Configured on: Thu Jul 21 10:30:39 CEST 2022
              Configured by: Seppel@scio-nb017
                Host system: x86_64-pc-msys
          Uname information: MSYS_NT-10.0-19044 scio-nb017 3.3.5-341.x86_64 2022-05-30 21:10 UTC x86_64 Msys
                   Byte sex: little-endian
         Installation point: /c/myprograms/hdf5/1.12.2/win10

```

## Compiling Options:

```
                 Build Mode: production
          Debugging Symbols: no
                    Asserts: no
                  Profiling: no
         Optimization Level: high

```

## Linking Options:

```
                  Libraries: static

```

Statically Linked Executables:  
LDFLAGS:  
H5\_LDFLAGS:  
AM\_LDFLAGS:  
Extra libraries: -lm  
Archiver: ar  
AR\_FLAGS: cr  
Ranlib: ranlib

## Languages:

```
                          C: yes
                 C Compiler: /c/mingw/bin/gcc
                   CPPFLAGS:
                H5_CPPFLAGS: -DNDEBUG -UH5_DEBUG_API
                AM_CPPFLAGS:
                    C Flags:
                 H5 C Flags:
                 AM C Flags:
           Shared C Library: no
           Static C Library: yes

                    Fortran: yes
           Fortran Compiler: /c/mingw/bin/gfortran
              Fortran Flags:
           H5 Fortran Flags:
           AM Fortran Flags:
     Shared Fortran Library: yes
     Static Fortran Library: yes

                        C++: yes
               C++ Compiler: /c/mingw/bin/g++
                  C++ Flags:
               H5 C++ Flags:
               AM C++ Flags:
         Shared C++ Library: no
         Static C++ Library: yes

                       Java: no

```

## Features:

```
                 Parallel HDF5: no

```

Parallel Filtered Dataset Writes: no  
Large Parallel I/O: no  
High-level library: yes  
Dimension scales w/ new references: no  
Build HDF5 Tests: yes  
Build HDF5 Tools: yes  
Threadsafety: no  
Default API mapping: v112  
With deprecated public symbols: yes  
I/O filters (external):  
MPE: no  
Map (H5M) API: no  
Direct VFD: no  
Mirror VFD: no  
(Read-Only) S3 VFD: no  
(Read-Only) HDFS VFD: no  
dmalloc: no  
Packages w/ extra debug output: none  
API tracing: no  
Using memory checker: no  
Memory allocation sanity checks: no  
Function stack tracing: no  
Use file locking: best-effort  
Strict file format checks: no  
Optimization instrumentation: no

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

than i wanted do make:

Seppel@scio-nb017 MSYS /d/Projects/Windows/myhdf5/hdf5-1.12.2  
$ mingw32-make

Output:  
Making all in src  
/usr/bin/sh: line 21: make: command not found  
Makefile:723: recipe for target ‘all-recursive’ failed  
mingw32-make: \*\*\* [all-recursive] Error 1  
☹

---

<div class="post-metadata">

**Author:** ![s.kraus](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@s.kraus](https://forum.hdfgroup.org/u/s.kraus)\
**Post date:** [July 21, 2022, 9:43am UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/11 "2022-07-21T09:43:20Z")

</div>

u dont have to try cmake for me if u say its working without for you maybe we find a way thats working for me to i just want the debugable libs out of it no matter how we did it ty

Sebastian

---

<div class="post-metadata">

**Author:** ![german.salazar](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@german.salazar](https://forum.hdfgroup.org/u/german.salazar)\
**Post date:** [July 21, 2022, 10:54am UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/12 "2022-07-21T10:54:12Z")

</div>

Just make a copy of minw32-make.exe and call it make.exe

---

<div class="post-metadata">

**Author:** ![s.kraus](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@s.kraus](https://forum.hdfgroup.org/u/s.kraus)\
**Post date:** [July 21, 2022, 11:50am UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/13 "2022-07-21T11:50:42Z")

</div>

that worked but than this

CC H5Ztrans.lo  
CCLD libhdf5.la  
.libs/H5FDstdio.o:H5FDstdio.c:(.text+0x91f): undefined reference to `fseeko' .libs/H5FDstdio.o:H5FDstdio.c:(.text+0x93d): undefined reference to`ftello’  
.libs/H5FDstdio.o:H5FDstdio.c:(.text+0x12d3): undefined reference to `fseeko' .libs/H5FDstdio.o:H5FDstdio.c:(.text+0x1880): undefined reference to`fseeko’  
.libs/H5PLpath.o:H5PLpath.c:(.text+0x5f4): undefined reference to `strtok_r' .libs/H5PLpath.o:H5PLpath.c:(.text+0x6b1): undefined reference to`strtok\_r’  
.libs/H5VLint.o:H5VLint.c:(.text+0x996): undefined reference to `strtok_r' .libs/H5VLint.o:H5VLint.c:(.text+0xd87): undefined reference to`strtok\_r’  
collect2.exe: error: ld returned 1 exit status  
Makefile:1191: recipe for target ‘libhdf5.la’ failed  
make[2]: \*\*\* [libhdf5.la] Error 1  
make[2]: Leaving directory ‘D:/Projects/Windows/myhdf5/hdf5-1.12.2/src’  
Makefile:1103: recipe for target ‘all’ failed  
make[1]: \*\*\* [all] Error 2  
make[1]: Leaving directory ‘D:/Projects/Windows/myhdf5/hdf5-1.12.2/src’  
Makefile:723: recipe for target ‘all-recursive’ failed  
make: \*\*\* [all-recursive] Error 1

---

<div class="post-metadata">

**Author:** ![s.kraus](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@s.kraus](https://forum.hdfgroup.org/u/s.kraus)\
**Post date:** [July 21, 2022, 12:07pm UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/14 "2022-07-21T12:07:16Z")

</div>

is ./configure doing config it automaticaly in 32 bit maybe this error are problems between 64 config and 32 bit compiler? If i have to set a flag for 32 bit how i would do this?

ok i found out that at least the strtok\_r function is not part of mingw32 but what i can now here just write it by my own or is there a config/complier flag that i have to set?

---

<div class="post-metadata">

**Author:** ![s.kraus](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@s.kraus](https://forum.hdfgroup.org/u/s.kraus)\
**Post date:** [July 21, 2022, 2:23pm UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/15 "2022-07-21T14:23:03Z")

</div>

was able to solve this by setting the strtok\_r to strtok but after this more and more function appear which are not in mingw32 did i something wrong here with flags or something else?

---

<div class="post-metadata">

**Author:** ![german.salazar](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@german.salazar](https://forum.hdfgroup.org/u/german.salazar)\
**Post date:** [July 21, 2022, 5:05pm UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/16 "2022-07-21T17:05:23Z")

</div>

I don’t know the answers to all those questions; I wouldn’t know what to do, either, if ./configure, make and make install does not work out of the box.

I will report my troubles a bit later…and I do have troubles, too…the same sources that I built on Linux, are not building on Windows.

---

<div class="post-metadata">

**Author:** ![german.salazar](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@german.salazar](https://forum.hdfgroup.org/u/german.salazar)\
**Post date:** [July 21, 2022, 9:48pm UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/17 "2022-07-21T21:48:42Z")

</div>

I did not get too far in the compilation process, either; the same sources I built in Linux are not building on Windows. Here are the 2 error messages that cause termination:

```
In file included from H5PLint.c:30:
H5PLint.c: In function 'H5PL__open':
H5PLpkg.h:97:33: warning: implicit declaration of function 'dlopen'; did you mean 'fdopen'? [-Wimplicit-function-declaration]
   97 | #define H5PL_OPEN_DLIB(S) dlopen(S, RTLD_LAZY | RTLD_LOCAL)
      | ^ ~~~~~
H5PLpkg.h:97:43: error: 'RTLD_LAZY' undeclared (first use in this function)
   97 | #define H5PL_OPEN_DLIB(S) dlopen(S, RTLD_LAZY | RTLD_LOCAL)
      | ^ ~~~~~~~~
H5PLpkg.h:97:55: error: 'RTLD_LOCAL' undeclared (first use in this function)
   97 | #define H5PL_OPEN_DLIB(S) dlopen(S, RTLD_LAZY | RTLD_LOCAL)
      | ^ ~~~~~~~~~
```

---

<div class="post-metadata">

**Author:** ![byrn](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/b/85f322/32.png) [@byrn](https://forum.hdfgroup.org/u/byrn)\
**Post date:** [July 21, 2022, 9:59pm UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/18 "2022-07-21T21:59:56Z")

</div>

Yes, windows does not have dlopen as it uses a different method. You will need to find a mingw version.

---

<div class="post-metadata">

**Author:** ![german.salazar](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@german.salazar](https://forum.hdfgroup.org/u/german.salazar)\
**Post date:** [July 22, 2022, 2:36am UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/19 "2022-07-22T02:36:55Z")

</div>

Update.

I just learned a few of things.

That dlopen for mingw does exist; I just installed it in my instance of msys2/mingw64:

```
pacman -S mingw-w64-x86_64-dlfcn

```

That this package provides library dl (/mingw64/lib/libdl.a).

Went back to take a look at the output from my initial ./configure and found this:

```
.
.
checking for dlfcn.h... no # <----- ojo
.
.
checking for ceil in -lm... yes
checking for dlopen in -ldl... no # <----- ojo
checking for ANSI C header files... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking dirent.h usability... yes
.
.

```

Started over and re-run ./configure; this time, I get:

```
checking for dlfcn.h... yes # <----- ojo
.
.
checking for dlopen in -ldl... yes # <----- ojo

```

…so, that’s how that works.

---

<div class="post-metadata">

**Author:** ![s.kraus](https://forum.hdfgroup.org/letter_avatar_proxy/v4/letter/s/e9c0ed/32.png) [@s.kraus](https://forum.hdfgroup.org/u/s.kraus)\
**Post date:** [July 22, 2022, 2:01pm UTC](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990/20 "2022-07-22T14:01:12Z")

</div>

if u use mingw 64 bit u can just pacman the whole hdf5 package but i was looking for mingw32 bit

[Next page](https://forum.hdfgroup.org/t/implement-hdf5-in-eclipse-cdt-for-a-c-tool/9990.md?page=2)
