Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Include libjpeg-turbo header file included in Qt

Include libjpeg-turbo header file included in Qt

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 6 Posters 1.8k Views
  • 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.
  • T Offline
    T Offline
    Taytoo
    wrote on 19 Apr 2021, 20:49 last edited by
    #1

    I built Qt with qjpeg library - which (if I'm not wrong) uses libjpeg-turbo. In my code, I also need to manually call libjpeg-turbo APIs, but I can't find the header file to include that will give me access to libjpeg-turbo apis. It doesn't even exist in the Qt static build folder.

    Where can I find it?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Taytoo
      wrote on 22 Apr 2021, 23:17 last edited by Taytoo 6 Nov 2022, 08:27
      #13

      I figured out the proper way to do this.

      In Qt configure command use flag -system-libjpeg, then later specify options:

      LIBJPEG_LIBS="<path to release static library file>" [Note: This is full path to jpeg.lib including filename]
      -I <path to libjpeg include dir> [Note: This is path to the directory containing include file]

      @kkoehne You're right, I was able to use release version of libjpeg static lib in my debug program without any issue.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kent-Dorfman
        wrote on 20 Apr 2021, 03:33 last edited by
        #2

        If it is (by your configuration options) the Qt default then it will be used by the Qt API calls by default. If you need to call the native API functions directly then you'll need to locate the header file in its system installed location. /usr/include/qjpeg? /usr/local/include/qjpeg?...where it is installed will depend on your system.

        If you are on a system that uses pkgconfig then that can help but you need to research how to use it and what if any mods you need to make to your project file.

        T 1 Reply Last reply 20 Apr 2021, 10:29
        0
        • K Kent-Dorfman
          20 Apr 2021, 03:33

          If it is (by your configuration options) the Qt default then it will be used by the Qt API calls by default. If you need to call the native API functions directly then you'll need to locate the header file in its system installed location. /usr/include/qjpeg? /usr/local/include/qjpeg?...where it is installed will depend on your system.

          If you are on a system that uses pkgconfig then that can help but you need to research how to use it and what if any mods you need to make to your project file.

          T Offline
          T Offline
          Taytoo
          wrote on 20 Apr 2021, 10:29 last edited by
          #3

          @Kent-Dorfman said in Include libjpeg-turbo header file included in Qt:

          your configuration options) the Qt default then it will be used by the Qt API calls by default. If you need to call the native API functions directly then you'll need to locate the header file in its system installed location. /usr/include/qjpeg? /usr/local/include/qjpeg?...where it is installed will depend on your system.
          If you are on a system that uses pkgconfig then that can help but you need to research how to use it and what if any mods you need to make to your project file.

          I'm on windows platform using static Qt build. I searched entire Qt install folder but jpeg library header isn't there. Its only present in Qt sources folder - but that's a different folder from install folder.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kkoehne
            Moderators
            wrote on 20 Apr 2021, 11:02 last edited by
            #4

            It's true that Qt bundles an embedded version of libjpeg-turbo. Anyhow, it's not part of the public API, so the header files are not installed when you install Qt, and the libjpeg binary API is AFAIK also not exported.

            A proper way to handle this is to build libjpeg yourself locally, independent of Qt. You can then let Qt use this version (pass -system-libjpeg to configure to make sure it picks it up).

            Director R&D, The Qt Company

            T H 2 Replies Last reply 20 Apr 2021, 11:56
            2
            • K kkoehne
              20 Apr 2021, 11:02

              It's true that Qt bundles an embedded version of libjpeg-turbo. Anyhow, it's not part of the public API, so the header files are not installed when you install Qt, and the libjpeg binary API is AFAIK also not exported.

              A proper way to handle this is to build libjpeg yourself locally, independent of Qt. You can then let Qt use this version (pass -system-libjpeg to configure to make sure it picks it up).

              T Offline
              T Offline
              Taytoo
              wrote on 20 Apr 2021, 11:56 last edited by
              #5

              @kkoehne said in Include libjpeg-turbo header file included in Qt:

              -system-libjpeg

              On windows, how do I provide path of my libjpeg lib/headers when using -system-libjpeg option?

              1 Reply Last reply
              0
              • K Offline
                K Offline
                kkoehne
                Moderators
                wrote on 20 Apr 2021, 15:30 last edited by
                #6

                @Taytoo said in Include libjpeg-turbo header file included in Qt:

                On windows, how do I provide path of my libjpeg lib/headers when using -system-libjpeg option?

                There are different options:

                • Extend the INCLUDE, LIBS environment variables with the respective directories
                • pass the respective directories to configure via -I, -L configure arguments

                Director R&D, The Qt Company

                T 1 Reply Last reply 20 Apr 2021, 21:28
                2
                • K kkoehne
                  20 Apr 2021, 15:30

                  @Taytoo said in Include libjpeg-turbo header file included in Qt:

                  On windows, how do I provide path of my libjpeg lib/headers when using -system-libjpeg option?

                  There are different options:

                  • Extend the INCLUDE, LIBS environment variables with the respective directories
                  • pass the respective directories to configure via -I, -L configure arguments
                  T Offline
                  T Offline
                  Taytoo
                  wrote on 20 Apr 2021, 21:28 last edited by
                  #7

                  @kkoehne I have debug and release versions of libjpeg-turbo in separate folders. How do I specify correct folder for each Qt build i.e. debug and release?

                  K 1 Reply Last reply 22 Apr 2021, 11:32
                  0
                  • C Online
                    C Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on 21 Apr 2021, 04:56 last edited by
                    #8

                    Either copy them into one directory or use this qmake construct: https://doc.qt.io/qt-5/qmake-test-function-reference.html#config-config

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    T 1 Reply Last reply 21 Apr 2021, 09:10
                    3
                    • C Christian Ehrlicher
                      21 Apr 2021, 04:56

                      Either copy them into one directory or use this qmake construct: https://doc.qt.io/qt-5/qmake-test-function-reference.html#config-config

                      T Offline
                      T Offline
                      Taytoo
                      wrote on 21 Apr 2021, 09:10 last edited by Taytoo
                      #9

                      @Christian-Ehrlicher Wouldn't just copying the jpeg lib result in build errors? Because if I build Qt by specifying path to release version of libjpeg, but then try to build my program in debug mode - msvc will complain about debug vs release crt runtime conflict. Reason being my program + qt libraries will be using debug crt runtime, but libjpeg will be referencing the release one.

                      Found this: https://forum.qt.io/topic/75056/configuring-qt-what-replaces-debug-and-release/

                      This guy had the same issue as mine. He built two versions of Qt, one debug and other release in separate folders, But installed them into a single folder. That way he got both builds using correct release and debug 3rd party libraries as well. What about this approach?

                      1 Reply Last reply
                      0
                      • C Online
                        C Online
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on 21 Apr 2021, 09:20 last edited by
                        #10

                        On Windows the debug library normally has a 'd' suffix to distinguish between debug and release libs so you don't override them by copying. If you don't like to coy it, use the qmake function.

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        T 1 Reply Last reply 21 Apr 2021, 09:47
                        2
                        • C Christian Ehrlicher
                          21 Apr 2021, 09:20

                          On Windows the debug library normally has a 'd' suffix to distinguish between debug and release libs so you don't override them by copying. If you don't like to coy it, use the qmake function.

                          T Offline
                          T Offline
                          Taytoo
                          wrote on 21 Apr 2021, 09:47 last edited by
                          #11

                          @Christian-Ehrlicher Can you explain the copy approach i.e. just copy the libjpeg I built (both debug and release) into existing Qt lib folder? or should I build Qt using those versions? If later, then how do I ensure that debug and release builds of Qt reference the appropriate debug/release version of libjpeg?

                          I'm using MSVC for building, how do I use qmake?

                          1 Reply Last reply
                          0
                          • T Taytoo
                            20 Apr 2021, 21:28

                            @kkoehne I have debug and release versions of libjpeg-turbo in separate folders. How do I specify correct folder for each Qt build i.e. debug and release?

                            K Offline
                            K Offline
                            kkoehne
                            Moderators
                            wrote on 22 Apr 2021, 11:32 last edited by
                            #12

                            @Taytoo said in Include libjpeg-turbo header file included in Qt:

                            I have debug and release versions of libjpeg-turbo in separate folders. How do I specify correct folder for each Qt build i.e. debug and release?

                            You mean you want to do a combined -debug-and-release build? I don't think that's easily possible, because Qt will always assume the library is called 'libjpeg.lib'. The approach @Christian-Ehrlicher refers to works though for the part where you link against libjpeg yourself, in your app.

                            Anyhow, do you really need a separate debug build of libjpeg? AFAIK libjpeg is C API only, in which case there's no problem with linking a release build of libjpeg also with a debug build of Qt libraries.

                            Director R&D, The Qt Company

                            1 Reply Last reply
                            1
                            • T Offline
                              T Offline
                              Taytoo
                              wrote on 22 Apr 2021, 23:17 last edited by Taytoo 6 Nov 2022, 08:27
                              #13

                              I figured out the proper way to do this.

                              In Qt configure command use flag -system-libjpeg, then later specify options:

                              LIBJPEG_LIBS="<path to release static library file>" [Note: This is full path to jpeg.lib including filename]
                              -I <path to libjpeg include dir> [Note: This is path to the directory containing include file]

                              @kkoehne You're right, I was able to use release version of libjpeg static lib in my debug program without any issue.

                              1 Reply Last reply
                              0
                              • K kkoehne
                                20 Apr 2021, 11:02

                                It's true that Qt bundles an embedded version of libjpeg-turbo. Anyhow, it's not part of the public API, so the header files are not installed when you install Qt, and the libjpeg binary API is AFAIK also not exported.

                                A proper way to handle this is to build libjpeg yourself locally, independent of Qt. You can then let Qt use this version (pass -system-libjpeg to configure to make sure it picks it up).

                                H Offline
                                H Offline
                                Houda_ATTIG
                                wrote on 3 May 2021, 07:41 last edited by
                                #14

                                @kkoehne; I am a beginner with Qt can you please tell me how to build libjpeg myself locally?

                                jsulmJ 1 Reply Last reply 3 May 2021, 07:48
                                0
                                • H Houda_ATTIG
                                  3 May 2021, 07:41

                                  @kkoehne; I am a beginner with Qt can you please tell me how to build libjpeg myself locally?

                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on 3 May 2021, 07:48 last edited by
                                  #15

                                  @Houda_ATTIG said in Include libjpeg-turbo header file included in Qt:

                                  I am a beginner with Qt can you please tell me how to build libjpeg myself locally?

                                  Building libjepeg has nothing to do with Qt.
                                  Download libjpeg source code (https://sourceforge.net/projects/libjpeg/) and read install.doc file included in the source code archive.

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

                                  1 Reply Last reply
                                  2
                                  • H Offline
                                    H Offline
                                    Houda_ATTIG
                                    wrote on 3 May 2021, 08:53 last edited by
                                    #16

                                    First of all thanks for your answer.
                                    well I am using windows 10 with Qt creator, which files am I supposed to choose?

                                    Makefile jconfig file System and/or compiler

                                    makefile.manx jconfig.manx Amiga, Manx Aztec C
                                    makefile.sas jconfig.sas Amiga, SAS C
                                    makeproj.mac jconfig.mac Apple Macintosh, Metrowerks CodeWarrior
                                    makjpeg.st jconfig.st Atari ST/STE/TT, Pure C or Turbo C
                                    makefile.bcc jconfig.bcc MS-DOS or OS/2, Borland C
                                    makefile.dj jconfig.dj MS-DOS, DJGPP (Delorie's port of GNU C)
                                    makefile.mc6 jconfig.mc6 MS-DOS, Microsoft C (16-bit only)
                                    makefile.wat jconfig.wat MS-DOS, OS/2, or Windows NT, Watcom C
                                    makefile.vc jconfig.vc Windows, MS Visual C++
                                    makefile.vs jconfig.vc Windows, MS Visual C++ 6 Developer Studio
                                    make
                                    .vc6
                                    makefile.vs jconfig.vc Windows, Visual Studio 2019 (v16)
                                    make*.v16
                                    makefile.b32 jconfig.vc Windows, Borland C++ 32-bit (bcc32)
                                    makefile.mms jconfig.vms Digital VMS, with MMS software
                                    makefile.vms jconfig.vms Digital VMS, without MMS software

                                    jsulmJ 1 Reply Last reply 3 May 2021, 09:10
                                    0
                                    • H Houda_ATTIG
                                      3 May 2021, 08:53

                                      First of all thanks for your answer.
                                      well I am using windows 10 with Qt creator, which files am I supposed to choose?

                                      Makefile jconfig file System and/or compiler

                                      makefile.manx jconfig.manx Amiga, Manx Aztec C
                                      makefile.sas jconfig.sas Amiga, SAS C
                                      makeproj.mac jconfig.mac Apple Macintosh, Metrowerks CodeWarrior
                                      makjpeg.st jconfig.st Atari ST/STE/TT, Pure C or Turbo C
                                      makefile.bcc jconfig.bcc MS-DOS or OS/2, Borland C
                                      makefile.dj jconfig.dj MS-DOS, DJGPP (Delorie's port of GNU C)
                                      makefile.mc6 jconfig.mc6 MS-DOS, Microsoft C (16-bit only)
                                      makefile.wat jconfig.wat MS-DOS, OS/2, or Windows NT, Watcom C
                                      makefile.vc jconfig.vc Windows, MS Visual C++
                                      makefile.vs jconfig.vc Windows, MS Visual C++ 6 Developer Studio
                                      make
                                      .vc6
                                      makefile.vs jconfig.vc Windows, Visual Studio 2019 (v16)
                                      make*.v16
                                      makefile.b32 jconfig.vc Windows, Borland C++ 32-bit (bcc32)
                                      makefile.mms jconfig.vms Digital VMS, with MMS software
                                      makefile.vms jconfig.vms Digital VMS, without MMS software

                                      jsulmJ Offline
                                      jsulmJ Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on 3 May 2021, 09:10 last edited by
                                      #17

                                      @Houda_ATTIG Probably

                                      makefile.vc	jconfig.vc	Windows NT/95, MS Visual C++
                                      

                                      But you will need MSVC++ compiler.

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

                                      1 Reply Last reply
                                      1
                                      • T Offline
                                        T Offline
                                        Taytoo
                                        wrote on 3 May 2021, 11:13 last edited by
                                        #18

                                        Use this: https://github.com/microsoft/vcpkg

                                        vcpkg allows your to build 100s of open source libraries with a single command e.g. ".\vcpkg install libjpeg-turbo". It also copies header and lib files to a specific folder that you only need to include once in your project.

                                        Make the effort to get familiar with vcpkg, it will save you a lot of time trying to build/use open source libraries.

                                        1 Reply Last reply
                                        0
                                        • T Offline
                                          T Offline
                                          Taytoo
                                          wrote on 11 Jun 2022, 07:57 last edited by Taytoo 6 Nov 2022, 08:13
                                          #19
                                          This post is deleted!
                                          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