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
QtWS25 Last Chance

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.
  • kkoehneK kkoehne

    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 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
    • kkoehneK Offline
      kkoehneK Offline
      kkoehne
      Moderators
      wrote on 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
      2
      • kkoehneK kkoehne

        @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 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?

        kkoehneK 1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 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
          3
          • Christian EhrlicherC Christian Ehrlicher

            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 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
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 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
              2
              • Christian EhrlicherC Christian Ehrlicher

                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 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

                  @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?

                  kkoehneK Offline
                  kkoehneK Offline
                  kkoehne
                  Moderators
                  wrote on 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 last edited by Taytoo
                    #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
                    • kkoehneK kkoehne

                      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 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
                      0
                      • H Houda_ATTIG

                        @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 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 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
                          0
                          • H Houda_ATTIG

                            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 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 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 last edited by Taytoo
                                #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