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.1k 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.
  • Pablo J. RoginaP Pablo J. Rogina

    @Please_Help_me_D said in Can't add HDF5 library in empty Qt-project:

    LIBS += -L$$PWD/../../../../../apps/MSVC_apps/HDF5/lib/

    For whatever is your PWD (project dir) that path won't match

    C:\apps\MSVC_apps_debug\HDF5\lib

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

    @Pablo-J-Rogina
    That is interesting, thank! Why those path are not equal?
    But anyway, I changed those lines to the following:

    LIBS += -LC:/apps/MSVC_apps_debug/HDF5/ -lhdf5_cpp_D
    
    INCLUDEPATH += C:/apps/MSVC_apps_debug/HDF5/include
    DEPENDPATH += C:/apps/MSVC_apps_debug/HDF5/include
    

    and nothing changed...

    jsulmJ 1 Reply Last reply
    0
    • Please_Help_me_DP Please_Help_me_D

      @Pablo-J-Rogina
      That is interesting, thank! Why those path are not equal?
      But anyway, I changed those lines to the following:

      LIBS += -LC:/apps/MSVC_apps_debug/HDF5/ -lhdf5_cpp_D
      
      INCLUDEPATH += C:/apps/MSVC_apps_debug/HDF5/include
      DEPENDPATH += C:/apps/MSVC_apps_debug/HDF5/include
      

      and nothing changed...

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #6

      @Please_Help_me_D Are you sure the missing symbols are in the lib you added? You should check that and add other libs if needed. Also, you added debug version of the lib: do you build your app in debug or release mode?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Please_Help_me_DP 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Please_Help_me_D Are you sure the missing symbols are in the lib you added? You should check that and add other libs if needed. Also, you added debug version of the lib: do you build your app in debug or release mode?

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

        @jsulm How to check the missing symbols are in the or not?
        I build debug version of libraries and I try to lauch Qt in debug mod. What is the difference between debug version of libraries and release? Can I build library in debug mod and launch it in Qt in release mod?
        Sorry for so many questions but I need to understand the basics of programming in Qt.

        jsulmJ 1 Reply Last reply
        0
        • Please_Help_me_DP Please_Help_me_D

          @jsulm How to check the missing symbols are in the or not?
          I build debug version of libraries and I try to lauch Qt in debug mod. What is the difference between debug version of libraries and release? Can I build library in debug mod and launch it in Qt in release mod?
          Sorry for so many questions but I need to understand the basics of programming in Qt.

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #8

          @Please_Help_me_D said in Can't add HDF5 library in empty Qt-project:

          How to check the missing symbols are in the or not?

          Don't know how to do it on Windows, on Linux there is nm tool.
          Take a look at https://stackoverflow.com/questions/305287/how-to-see-the-contents-of-windows-library-lib

          On Windows you should not mix debug and release binaries. But since you're building in debug mode it should be fine.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

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

            Seeing the numbers of .dll files in your bin folder, you shall have the same number of .lib files somewhere. I suspect that you are not linking enough of the hdf5 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
            • jsulmJ jsulm

              @Please_Help_me_D said in Can't add HDF5 library in empty Qt-project:

              How to check the missing symbols are in the or not?

              Don't know how to do it on Windows, on Linux there is nm tool.
              Take a look at https://stackoverflow.com/questions/305287/how-to-see-the-contents-of-windows-library-lib

              On Windows you should not mix debug and release binaries. But since you're building in debug mode it should be fine.

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

              @jsulm I followed the link you gave and output of dumpbin command:

              dumpbin /EXPORTS hdf5_cpp_D.lib
              

              is inside the link (let me know if it works): output_from_dumpbin
              I don't know know yet how to read it.

              @SGaist I looked to the lib folder and the number of libraries doesn't match to the number of .dll in bin folder. I also tried to add all the libraries:

              LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/lhdf5_cpp_D.lib"
              LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/lhdf5_D.lib"
              LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/hdf5_hl_cpp_D.lib"
              LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/hdf5_hl_D.lib"
              LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/hdf5_tools_D.lib"
              
              INCLUDEPATH += C:/apps/MSVC_apps_debug/HDF5/include
              DEPENDPATH += C:/apps/MSVC_apps_debug/HDF5/include
              

              but the errors don't change
              lib.png

              K 1 Reply Last reply
              0
              • Please_Help_me_DP Please_Help_me_D

                @jsulm I followed the link you gave and output of dumpbin command:

                dumpbin /EXPORTS hdf5_cpp_D.lib
                

                is inside the link (let me know if it works): output_from_dumpbin
                I don't know know yet how to read it.

                @SGaist I looked to the lib folder and the number of libraries doesn't match to the number of .dll in bin folder. I also tried to add all the libraries:

                LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/lhdf5_cpp_D.lib"
                LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/lhdf5_D.lib"
                LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/hdf5_hl_cpp_D.lib"
                LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/hdf5_hl_D.lib"
                LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/hdf5_tools_D.lib"
                
                INCLUDEPATH += C:/apps/MSVC_apps_debug/HDF5/include
                DEPENDPATH += C:/apps/MSVC_apps_debug/HDF5/include
                

                but the errors don't change
                lib.png

                K Offline
                K Offline
                Konstantin Tokarev
                wrote on last edited by
                #11

                @Please_Help_me_D said in Can't add HDF5 library in empty Qt-project:

                LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/lhdf5_D.lib"

                This is not a correct syntax. Please try

                LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/hdf5_D.lib"

                and so on

                Please_Help_me_DP 1 Reply Last reply
                0
                • K Konstantin Tokarev

                  @Please_Help_me_D said in Can't add HDF5 library in empty Qt-project:

                  LIBS += "-LC:/apps/MSVC_apps_debug/HDF5/lib/lhdf5_D.lib"

                  This is not a correct syntax. Please try

                  LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/hdf5_D.lib"

                  and so on

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

                  @Konstantin-Tokarev I just tried:

                  LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/lhdf5_cpp_D.lib"
                  LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/lhdf5_D.lib"
                  LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/hdf5_hl_cpp_D.lib"
                  LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/hdf5_hl_D.lib"
                  LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/hdf5_tools_D.lib"
                  
                  INCLUDEPATH += C:/apps/MSVC_apps_debug/HDF5/include
                  DEPENDPATH += C:/apps/MSVC_apps_debug/HDF5/include
                  

                  I get an error:
                  error: LNK1104: can't open file "C:\apps\MSVC_apps_debug\HDF5\lib\lhdf5_cpp_D.lib"
                  Does it depend that libraries were built with GUI Cmake and the project I run with qmake?

                  K 1 Reply Last reply
                  0
                  • Please_Help_me_DP Please_Help_me_D

                    @Konstantin-Tokarev I just tried:

                    LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/lhdf5_cpp_D.lib"
                    LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/lhdf5_D.lib"
                    LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/hdf5_hl_cpp_D.lib"
                    LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/hdf5_hl_D.lib"
                    LIBS += "C:/apps/MSVC_apps_debug/HDF5/lib/hdf5_tools_D.lib"
                    
                    INCLUDEPATH += C:/apps/MSVC_apps_debug/HDF5/include
                    DEPENDPATH += C:/apps/MSVC_apps_debug/HDF5/include
                    

                    I get an error:
                    error: LNK1104: can't open file "C:\apps\MSVC_apps_debug\HDF5\lib\lhdf5_cpp_D.lib"
                    Does it depend that libraries were built with GUI Cmake and the project I run with qmake?

                    K Offline
                    K Offline
                    Konstantin Tokarev
                    wrote on last edited by
                    #13

                    @Please_Help_me_D You have an error in your path: file name is hdf5_cpp_D.lib while you are using lhdf5_cpp_D.lib

                    Please_Help_me_DP 1 Reply Last reply
                    1
                    • K Konstantin Tokarev

                      @Please_Help_me_D You have an error in your path: file name is hdf5_cpp_D.lib while you are using lhdf5_cpp_D.lib

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

                      @Konstantin-Tokarev i'm sorry, my mistake. I changed it to the correct name and the errors now are:
                      main.obj: -1: error: LNK2001: unresolved external character "" public: static class H5 :: FileAccPropList const & const H5 :: FileAccPropList :: DEFAULT "(? DEFAULT @ FileAccPropList @ H5 @@ 2AEBV12 @ EB)"
                      main.obj: -1: error: LNK2001: unresolved external character "" public: static class H5 :: FileCreatPropList const & const H5 :: FileCreatPropList :: DEFAULT "(? DEFAULT @ FileCreatPropList @ H5 @@ 2AEBV12 @ EB)"
                      etc...
                      debug \ HDF5.exe: -1: error: LNK1120: unresolved external elements: 6

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        Konstantin Tokarev
                        wrote on last edited by
                        #15

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

                        Please_Help_me_DP 2 Replies Last reply
                        0
                        • 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
                          #16

                          @Konstantin-Tokarev I did

                          dumpbin /EXPORTS each_of_my_labrary
                          

                          and I only found that FileAccPropList belongs to hdf5_cpp_D.lib.
                          One thing seemed to me interesting... When I built HDF5 libraries there was an option to include C++ libraries and I included them. Now output from dumpbin C and C++ libraries are very different. Here are few lines of dumpbin C.lib:

                          Microsoft (R) COFF/PE Dumper Version 14.16.27030.1
                          Copyright (C) Microsoft Corporation.  All rights reserved.
                          
                          
                          Dump of file C:\apps\MSVC_apps_debug\HDF5\lib\hdf5_D.lib
                          
                          File Type: LIBRARY
                          
                               Exports
                          
                                 ordinal    name
                          
                                            H5AC_BT
                                            H5AC_BT2_HDR
                                            H5AC_BT2_INT
                                            H5AC_BT2_LEAF
                                            H5AC_DRVRINFO
                                            H5AC_EARRAY_DBLK_PAGE
                                            H5AC_EARRAY_DBLOCK
                                            H5AC_EARRAY_HDR
                          

                          And here are few lines of dumpbin C++.lib:

                          Microsoft (R) COFF/PE Dumper Version 14.16.27030.1
                          Copyright (C) Microsoft Corporation.  All rights reserved.
                          
                          
                          Dump of file C:\apps\MSVC_apps_debug\HDF5\lib\hdf5_cpp_D.lib
                          
                          File Type: LIBRARY
                          
                               Exports
                          
                                 ordinal    name
                          
                                            ??0AbstractDs@H5@@IEAA@XZ (protected: __cdecl H5::AbstractDs::AbstractDs(void))
                                            ??0AbstractDs@H5@@QEAA@AEBV01@@Z (public: __cdecl H5::AbstractDs::AbstractDs(class H5::AbstractDs const &))
                                            ??0ArrayType@H5@@QEAA@AEBV01@@Z (public: __cdecl H5::ArrayType::ArrayType(class H5::ArrayType const &))
                                            ??0ArrayType@H5@@QEAA@AEBVDataType@1@HPEB_K@Z (public: __cdecl H5::ArrayType::ArrayType(class H5::DataType const &,int,unsigned __int64 const *))
                                            ??0ArrayType@H5@@QEAA@AEBVH5Location@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z (public: __cdecl H5::ArrayType::ArrayType(class H5::H5Location const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &))
                                            ??0ArrayType@H5@@QEAA@AEBVH5Location@1@PEBD@Z (public: __cdecl H5::ArrayType::ArrayType(class H5::H5Location const &,char const *))
                                            ??0ArrayType@H5@@QEAA@XZ (public: __cdecl H5::ArrayType::ArrayType(void))
                                            ??0ArrayType@H5@@QEAA@_J@Z (public: __cdecl H5::ArrayType::ArrayType(__int64))
                          

                          How do you think, maybe C++ libraries were installed incorretly?

                          1 Reply Last reply
                          0
                          • 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

                                          • Login

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