Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Can't add HDF5 library in empty Qt-project
Forum Updated to NodeBB v4.3 + New Features

Can't add HDF5 library in empty Qt-project

Scheduled Pinned Locked Moved Solved C++ Gurus
34 Posts 5 Posters 7.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Konstantin Tokarev

    Make sure that all paths correspond to existing files.Find in which library H5 :: FileAccPropList is defined

    Please_Help_me_DP Offline
    Please_Help_me_DP Offline
    Please_Help_me_D
    wrote on last edited by
    #17

    @Konstantin-Tokarev @SGaist @jsulm as you suspected the problem was that used wrong libraries. Those libraries whose names begin with lib are static. And those who don't those are shared (information from HDFGroup web-site, see picture).
    Previously I tried to include shared libraries and they don't work (don't know why). Now I use static libraries and they work.
    So I use the followng lines (it works):

    LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/libhdf5_cpp_D.lib"
    LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/libhdf5_D.lib"
    LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/libhdf5_hl_cpp_D.lib"
    LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/libhdf5_hl_D.lib"
    LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/libhdf5_tools_D.lib"
    
    INCLUDEPATH += C:/apps/MSVC_apps_debug/HDF5/include
    DEPENDPATH += C:/apps/MSVC_apps_debug/HDF5/include
    

    Can you give me advise why shared libraries don't work? How should I decide whether to use shared or static libraries?
    HDF5.png

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #18

      So you tried to link to .dll files which are the shared libraries but not what you use to link to on Windows.

      .lib files can be either the static version of the libraries or an "import file" used to tell the linker what symbols it will have from the library. The usual way to know which type it is is by looking at its size. Small sizes suggest that you have the import file while bigger sizes suggest static libraries.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Please_Help_me_DP 1 Reply Last reply
      2
      • SGaistS SGaist

        So you tried to link to .dll files which are the shared libraries but not what you use to link to on Windows.

        .lib files can be either the static version of the libraries or an "import file" used to tell the linker what symbols it will have from the library. The usual way to know which type it is is by looking at its size. Small sizes suggest that you have the import file while bigger sizes suggest static libraries.

        Please_Help_me_DP Offline
        Please_Help_me_DP Offline
        Please_Help_me_D
        wrote on last edited by
        #19

        @SGaist thank you for information about the weight of static and shared libraries. One of my shared library weighs 380 kb and the same static library weighs 33 Mb.
        I opened them with help of 7zip and I saw that shared .lib-file include .dll files, and static .lib-file includes .obj files (see picture).
        Is there a connection between libraries .lib and .exe files and .dll files that are in the bin folder?static_shared.jpg

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #20

          I was talking about the .lib files themselves.

          .dll are in any shared libraries.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • Please_Help_me_DP Offline
            Please_Help_me_DP Offline
            Please_Help_me_D
            wrote on last edited by
            #21

            I encountered a problem that when I build HDF5 without ZLIB I can run HDF5 library in Qt (as static library for example). But when building HDF5 with ZLIB=on then I can run HDF5 only as dynamic library and still I get error: LNK2001: unresolved external character "H5T_STD_I32BE_g" when I set format for my saving data like integer 32 big endian (or any other data formats). The other functionality works properly (for example I can create empty HDF5-files and add groups in them etc). What maybe the reason of this strange behaviour?
            ZLIB, HDF5 builded in DEBUG mode.
            If my HDF5 library depends on ZLIB library then in QMake should I add some strings about ZLIB?

            1 Reply Last reply
            0
            • Please_Help_me_DP Offline
              Please_Help_me_DP Offline
              Please_Help_me_D
              wrote on last edited by
              #22

              I added ZLIB library to the QMake and it worked :)

              1 Reply Last reply
              0
              • Please_Help_me_DP Offline
                Please_Help_me_DP Offline
                Please_Help_me_D
                wrote on last edited by
                #23

                To the New Yaer event I got SSD-disk :)
                So I decided to install Windows 10 x64 and now I have disk C:\ on SSD and HDD stores all my data from previous installed Windows 7 x64.

                I have strange situation... When I run Qt project that uses HDF5 library and this library is on old HDD then I can normally run it.
                If I copy HDF5 library to the SSD then I get the following error:
                error: C1083: Cannot open include file: 'hdf5.h': No such file or directory

                I use:

                #include "hdf5.h"
                

                and in .pro file I have:

                LIBS += С:/apps/MSVC_apps_debug/HDF5_1106/lib/libhdf5_D.lib \
                        С:/apps/MSVC_apps_debug/HDF5_1106/lib/libhdf5_hl_D.lib \
                        С:/apps/MSVC_apps_debug/ZLIB/lib/libzlib_D.lib
                
                INCLUDEPATH += С:/apps/MSVC_apps_debug/HDF5_1106/include \
                               С:/apps/MSVC_apps_debug/ZLIB/include
                DEPENDPATH += С:/apps/MSVC_apps_debug/HDF5_1106/include \
                              С:/apps/MSVC_apps_debug/ZLIB/include
                

                By the way it doesn't depend if I recompile HDF5 library with installation folder on C:/ or just copy it from E:/ to C:/ (I mean copy from HDD to SSD). In both cases I get the same error.

                Why Qt can't see this header file in include folder?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #24

                  Did you check the build log to see if the paths you added are used ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  Please_Help_me_DP 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    Did you check the build log to see if the paths you added are used ?

                    Please_Help_me_DP Offline
                    Please_Help_me_DP Offline
                    Please_Help_me_D
                    wrote on last edited by
                    #25

                    @SGaist As far as I see yes. I marked it with bold style.
                    The compilator output uses backslashes () and I use slash (/) when pointing a directory. In Windows 7 slashes worked normally, couldn't that be a reason in Windows 10?

                    21:37:47: Launching: «C:\Qt\Tools\qtcreator-4.11.0\bin\jom.exe»
                    C:\Qt\Tools\qtcreator-4.11.0\bin\jom.exe -f Makefile.Debug
                    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ReadSegy.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I..\ReadSegy -I. -IС­:/apps/MSVC_apps_debug/HDF5_1106/include -IС­:/apps/MSVC_apps_debug/ZLIB/include -IC:\Qt\5.12.6\msvc2017_64\include -IC:\Qt\5.12.6\msvc2017_64\include\QtCore -Idebug -IC:\Qt\5.12.6\msvc2017_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\tasik\AppData\Local\Temp\checkandwritehdf5.obj.4376.15.jom
                    checkandwritehdf5.cpp
                    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ReadSegy.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I..\ReadSegy -I. -IС­:/apps/MSVC_apps_debug/HDF5_1106/include -IС­:/apps/MSVC_apps_debug/ZLIB/include -IC:\Qt\5.12.6\msvc2017_64\include -IC:\Qt\5.12.6\msvc2017_64\include\QtCore -Idebug -IC:\Qt\5.12.6\msvc2017_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\tasik\AppData\Local\Temp\readsegy.obj.4376.31.jom
                    readsegy.cpp
                    c:\users\tasik\documents\qt_projects\readsegy\readsegy.h(5): fatal error C1083: Cannot open include file: 'hdf5.h': No such file or directory
                    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ReadSegy.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I..\ReadSegy -I. -IС­:/apps/MSVC_apps_debug/HDF5_1106/include -IС­:/apps/MSVC_apps_debug/ZLIB/include -IC:\Qt\5.12.6\msvc2017_64\include -IC:\Qt\5.12.6\msvc2017_64\include\QtCore -Idebug -IC:\Qt\5.12.6\msvc2017_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\tasik\AppData\Local\Temp\main.obj.4376.15.jom
                    main.cpp
                    c:\users\tasik\documents\qt_projects\readsegy\readsegy.h(5): fatal error C1083: Cannot open include file: 'hdf5.h': No such file or directory
                    c:\users\tasik\documents\qt_projects\readsegy\checkandwritehdf5.h(2): fatal error C1083: Cannot open include file: 'hdf5.h': No such file or directory
                    jom: C:\Users\tasik\Documents\Qt_Projects\build-ReadSegy-Desktop_Qt_5_12_6_MSVC2017_64_bit-Debug\Makefile.Debug [debug\checkandwritehdf5.obj] Error 2
                    jom: C:\Users\tasik\Documents\Qt_Projects\build-ReadSegy-Desktop_Qt_5_12_6_MSVC2017_64_bit-Debug\Makefile.Debug [debug\main.obj] Error 2
                    jom: C:\Users\tasik\Documents\Qt_Projects\build-ReadSegy-Desktop_Qt_5_12_6_MSVC2017_64_bit-Debug\Makefile.Debug [debug\readsegy.obj] Error 2
                    jom: C:\Users\tasik\Documents\Qt_Projects\build-ReadSegy-Desktop_Qt_5_12_6_MSVC2017_64_bit-Debug\Makefile [debug] Error 2

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #26

                      That's surprising... the slash/backslash conversion should be handled automatically for you.

                      What happens if you uses backslashes in your .pro file ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      Please_Help_me_DP 1 Reply Last reply
                      1
                      • SGaistS SGaist

                        That's surprising... the slash/backslash conversion should be handled automatically for you.

                        What happens if you uses backslashes in your .pro file ?

                        Please_Help_me_DP Offline
                        Please_Help_me_DP Offline
                        Please_Help_me_D
                        wrote on last edited by
                        #27

                        @SGaist Now I wrote:

                        LIBS += С:\apps\MSVC_apps_debug\HDF5_1106\lib\libhdf5_D.lib \
                                С:\apps\MSVC_apps_debug\HDF5_1106\lib\libhdf5_hl_D.lib \
                                С:\apps\MSVC_apps_debug\ZLIB\lib\libzlib_D.lib
                        
                        INCLUDEPATH += С:\apps\MSVC_apps_debug\HDF5_1106\include \
                                       С:\apps\MSVC_apps_debug\ZLIB\include
                        DEPENDPATH += С:\apps\MSVC_apps_debug\HDF5_1106\include \
                                      С:\apps\MSVC_apps_debug\ZLIB\include
                        

                        and I get the same error:
                        C:\Users\tasik\Documents\Qt_Projects\ReadSegy\checkandwritehdf5.h:2: ошибка: C1083: Cannot open include file: 'hdf5.h': No such file or directory

                        The compilator output:
                        22:10:58: Запускается: «C:\Qt\Tools\qtcreator-4.11.0\bin\jom.exe»
                        C:\Qt\Tools\qtcreator-4.11.0\bin\jom.exe -f Makefile.Debug
                        cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ReadSegy.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I..\ReadSegy -I. -IС­:\apps\MSVC_apps_debug\HDF5_1106\include -IС­:\apps\MSVC_apps_debug\ZLIB\include -IC:\Qt\5.12.6\msvc2017_64\include -IC:\Qt\5.12.6\msvc2017_64\include\QtCore -Idebug -IC:\Qt\5.12.6\msvc2017_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\tasik\AppData\Local\Temp\checkandwritehdf5.obj.7080.0.jom
                        checkandwritehdf5.cpp
                        c:\users\tasik\documents\qt_projects\readsegy\checkandwritehdf5.h(2): fatal error C1083: Cannot open include file: 'hdf5.h': No such file or directory
                        cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ReadSegy.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I..\ReadSegy -I. -IС­:\apps\MSVC_apps_debug\HDF5_1106\include -IС­:\apps\MSVC_apps_debug\ZLIB\include -IC:\Qt\5.12.6\msvc2017_64\include -IC:\Qt\5.12.6\msvc2017_64\include\QtCore -Idebug -IC:\Qt\5.12.6\msvc2017_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\tasik\AppData\Local\Temp\main.obj.7080.16.jom
                        main.cpp
                        c:\users\tasik\documents\qt_projects\readsegy\readsegy.h(5): fatal error C1083: Cannot open include file: 'hdf5.h': No such file or directory
                        jom: C:\Users\tasik\Documents\Qt_Projects\build-ReadSegy-Desktop_Qt_5_12_6_MSVC2017_64_bit-Debug\Makefile.Debug [debug\checkandwritehdf5.obj] Error 2
                        cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\ReadSegy.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_CORE_LIB -I..\ReadSegy -I. -IС­:\apps\MSVC_apps_debug\HDF5_1106\include -IС­:\apps\MSVC_apps_debug\ZLIB\include -IC:\Qt\5.12.6\msvc2017_64\include -IC:\Qt\5.12.6\msvc2017_64\include\QtCore -Idebug -IC:\Qt\5.12.6\msvc2017_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\tasik\AppData\Local\Temp\readsegy.obj.7080.16.jom
                        readsegy.cpp
                        c:\users\tasik\documents\qt_projects\readsegy\readsegy.h(5): fatal error C1083: Cannot open include file: 'hdf5.h': No such file or directory
                        jom: C:\Users\tasik\Documents\Qt_Projects\build-ReadSegy-Desktop_Qt_5_12_6_MSVC2017_64_bit-Debug\Makefile.Debug [debug\readsegy.obj] Error 2
                        jom: C:\Users\tasik\Documents\Qt_Projects\build-ReadSegy-Desktop_Qt_5_12_6_MSVC2017_64_bit-Debug\Makefile.Debug [debug\main.obj] Error 2
                        jom: C:\Users\tasik\Documents\Qt_Projects\build-ReadSegy-Desktop_Qt_5_12_6_MSVC2017_64_bit-Debug\Makefile [debug] Error 2

                        Both variants are possible? That is useful because I always forget the way I should use slash or backslash :)

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #28

                          Well, by default use forward slashes. Qt does the conversion and you even have specific functions in QDir for converting if you need the native version.

                          Can you show the exact path where the header is located including the file name ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          Please_Help_me_DP 2 Replies Last reply
                          1
                          • SGaistS SGaist

                            Well, by default use forward slashes. Qt does the conversion and you even have specific functions in QDir for converting if you need the native version.

                            Can you show the exact path where the header is located including the file name ?

                            Please_Help_me_DP Offline
                            Please_Help_me_DP Offline
                            Please_Help_me_D
                            wrote on last edited by
                            #29

                            @SGaist ok
                            i write from my phone now but it is here:
                            C:/apps/MSVC_debug/HDF5_1106/lib/libhdf5_D.lib
                            C:/apps/MSVC_debug/HDF5_1106/include

                            I probably mistaken a little but there is no spaces in path.
                            A little bit later i can copy the correct path

                            1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Well, by default use forward slashes. Qt does the conversion and you even have specific functions in QDir for converting if you need the native version.

                              Can you show the exact path where the header is located including the file name ?

                              Please_Help_me_DP Offline
                              Please_Help_me_DP Offline
                              Please_Help_me_D
                              wrote on last edited by
                              #30

                              @SGaist On SSD disk include directory that contains "hdf5.h" is in:
                              C:\apps\MSVC_apps_debug\HDF5_1106\include\hdf5.h

                              And on HDD disk (that used to be the C:\ folder when I had Windows 7):
                              E:\apps\MSVC_apps_debug\HDF5_NO_MPI\include\hdf5.h

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #31

                                Might be a silly question but do you have proper read access to these folders ?

                                One other thing to try, create a new default project and just put the minimal needed to use hdf5.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                Please_Help_me_DP 1 Reply Last reply
                                1
                                • SGaistS SGaist

                                  Might be a silly question but do you have proper read access to these folders ?

                                  One other thing to try, create a new default project and just put the minimal needed to use hdf5.

                                  Please_Help_me_DP Offline
                                  Please_Help_me_DP Offline
                                  Please_Help_me_D
                                  wrote on last edited by
                                  #32

                                  @SGaist yes I have permission. And yesterday I've tried to create new project and copy the content to it but it did't solve the problem.

                                  Few minuts ago I just tried the following. I have two QtCreator: one is standart that comes with Qt (compiled with MSVC 32 C:\Qt\Tools\QtCreator) and other I installed to the folder C:\Qt\Tools\qtcreator-4.11.0 that is compiled with MSVC 64. Yesterday I was trying to use the one that compiled with MSVC 64. But now I tried to use standart QtCreator x32 and it runs the apllication without problem. After that I launched QtCreator x64 and it runs too.

                                  I don't know why this happened but I think there is two possible reasons:

                                  1. I always used wrong path to the library and include directory (I checked it many times but still such things sometimes happen)
                                  2. something that is connected with the build type of QtCreator x32 or x64 (or how they were installed or kits). Both of them of version 4.11.0
                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #33

                                    What I meant was to not use anything from your other project so you would have something completely independent.

                                    As for Qt Creator, its architecture has nothing to do with the architecture of the Qt version you are using.

                                    Anyway, glad you have it working now !

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    Please_Help_me_DP 1 Reply Last reply
                                    1
                                    • SGaistS SGaist

                                      What I meant was to not use anything from your other project so you would have something completely independent.

                                      As for Qt Creator, its architecture has nothing to do with the architecture of the Qt version you are using.

                                      Anyway, glad you have it working now !

                                      Please_Help_me_DP Offline
                                      Please_Help_me_DP Offline
                                      Please_Help_me_D
                                      wrote on last edited by
                                      #34

                                      @SGaist Thank you for the time you spent!

                                      1 Reply Last reply
                                      0

                                      • Login

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Users
                                      • Groups
                                      • Search
                                      • Get Qt Extensions
                                      • Unsolved