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 webp.lib to project
Forum Updated to NodeBB v4.3 + New Features

Include webp.lib to project

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 606 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.
  • M Offline
    M Offline
    MyNameIsQt
    wrote on 19 Mar 2023, 07:52 last edited by
    #1

    My project loads and displays (jpeg, png) images in several formats. everything works fine.
    In order to add web, I put ".lib" for Windows and Linux in one folder as shown in the picture, and set up and compiled the pro file as above.
    I did "include/encode.h" and "include/decode.h".

    캡처sdf.PNG

    
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/webp -lwebp
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/webp -lwebp
    else:unix: LIBS += -L$$PWD/webp -lwebp
    
    INCLUDEPATH += $$PWD/webp
    LIBS += -L$$PWD/webp
    DEPENDPATH += $$PWD/webp
    
    

    Compiled in MinGW environment. Compilation itself works.
    If I don't link to the .pro file, I get an error, but the compilation doesn't invoke a message like "Cannot find -lwebp".

    So I put the following sentence.
    Compiling at this point crashes and the window doesn't show up.
    If I delete the WebPConfig statement below and recompile it works fine.
    What could be the problem?

    WebPConfig config;
        if (!WebPConfigInit(&config)) {
            QMessageBox::information(this, "title", tr("Failed initialize WebPConfig."));
            return false;
        }
    

    I create the project with qmake and debug it in MingGW environment.
    Thanks for your time.

    J C 2 Replies Last reply 19 Mar 2023, 08:42
    0
    • M MyNameIsQt
      19 Mar 2023, 07:52

      My project loads and displays (jpeg, png) images in several formats. everything works fine.
      In order to add web, I put ".lib" for Windows and Linux in one folder as shown in the picture, and set up and compiled the pro file as above.
      I did "include/encode.h" and "include/decode.h".

      캡처sdf.PNG

      
      win32:CONFIG(release, debug|release): LIBS += -L$$PWD/webp -lwebp
      else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/webp -lwebp
      else:unix: LIBS += -L$$PWD/webp -lwebp
      
      INCLUDEPATH += $$PWD/webp
      LIBS += -L$$PWD/webp
      DEPENDPATH += $$PWD/webp
      
      

      Compiled in MinGW environment. Compilation itself works.
      If I don't link to the .pro file, I get an error, but the compilation doesn't invoke a message like "Cannot find -lwebp".

      So I put the following sentence.
      Compiling at this point crashes and the window doesn't show up.
      If I delete the WebPConfig statement below and recompile it works fine.
      What could be the problem?

      WebPConfig config;
          if (!WebPConfigInit(&config)) {
              QMessageBox::information(this, "title", tr("Failed initialize WebPConfig."));
              return false;
          }
      

      I create the project with qmake and debug it in MingGW environment.
      Thanks for your time.

      C Offline
      C Offline
      ChrisW67
      wrote on 20 Mar 2023, 04:05 last edited by ChrisW67
      #4

      @MyNameIsQt said in Include webp.lib to project:

      Compiled in MinGW environment. Compilation itself works.
      and
      Compiling at this point crashes and the window doesn't show up.

      • Compile == each source code file is syntactically correct and complete
      • Link == the object files from compile plus any included libraries produce a result with no undefined references (i.e. between files or libraries)
      • Run == The result of linking can find everything it is dynamically linked to in order to start.

      If the compiler and linker were happy (your first statement) then this sounds like running your program crashes at start. Crashing a compiler or linker is a rare thing.

      The most likely reason for the program failing after adding a new run-time dependency is that the dependency is not met at run-time. The webp.dll (matching the libwebp.a link library) must either be in the current working directory of your running program, on the system PATH, or in one of the few standard locations that Windows looks. If the other libraries in your directory are directly, or indirectly, required then this applies to them as well.

      J 1 Reply Last reply 20 Mar 2023, 08:16
      3
      • M MyNameIsQt
        19 Mar 2023, 07:52

        My project loads and displays (jpeg, png) images in several formats. everything works fine.
        In order to add web, I put ".lib" for Windows and Linux in one folder as shown in the picture, and set up and compiled the pro file as above.
        I did "include/encode.h" and "include/decode.h".

        캡처sdf.PNG

        
        win32:CONFIG(release, debug|release): LIBS += -L$$PWD/webp -lwebp
        else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/webp -lwebp
        else:unix: LIBS += -L$$PWD/webp -lwebp
        
        INCLUDEPATH += $$PWD/webp
        LIBS += -L$$PWD/webp
        DEPENDPATH += $$PWD/webp
        
        

        Compiled in MinGW environment. Compilation itself works.
        If I don't link to the .pro file, I get an error, but the compilation doesn't invoke a message like "Cannot find -lwebp".

        So I put the following sentence.
        Compiling at this point crashes and the window doesn't show up.
        If I delete the WebPConfig statement below and recompile it works fine.
        What could be the problem?

        WebPConfig config;
            if (!WebPConfigInit(&config)) {
                QMessageBox::information(this, "title", tr("Failed initialize WebPConfig."));
                return false;
            }
        

        I create the project with qmake and debug it in MingGW environment.
        Thanks for your time.

        J Offline
        J Offline
        JonB
        wrote on 19 Mar 2023, 08:42 last edited by JonB
        #2

        @MyNameIsQt said in Include webp.lib to project:

        If I don't link to the .pro file, I get an error, but the compilation doesn't invoke a message like "Cannot find -lwebp".

        There is no such thing as "link to the .pro file", so don't know what that means.

        Compiling at this point crashes and the window doesn't show up.

        How does "compiling crash"? The compiler crashes?? I doubt it.

        Do you mean "code always compiles and links fine, but when run it crashes on the call to WebPConfigInit(&config)"? If so any number of things might be wrong. Bad code, incompatible versions, incompatible compiler options, incorrect usage of function call, etc. You might (or might not) glean something by looking through the stack trace from the debugger when it crashes.

        M 1 Reply Last reply 19 Mar 2023, 18:09
        0
        • J JonB
          19 Mar 2023, 08:42

          @MyNameIsQt said in Include webp.lib to project:

          If I don't link to the .pro file, I get an error, but the compilation doesn't invoke a message like "Cannot find -lwebp".

          There is no such thing as "link to the .pro file", so don't know what that means.

          Compiling at this point crashes and the window doesn't show up.

          How does "compiling crash"? The compiler crashes?? I doubt it.

          Do you mean "code always compiles and links fine, but when run it crashes on the call to WebPConfigInit(&config)"? If so any number of things might be wrong. Bad code, incompatible versions, incompatible compiler options, incorrect usage of function call, etc. You might (or might not) glean something by looking through the stack trace from the debugger when it crashes.

          M Offline
          M Offline
          MyNameIsQt
          wrote on 19 Mar 2023, 18:09 last edited by
          #3

          @JonB
          I'm sorry. English isn't my native language. sorry about that.
          Are you means the .pro file is wrong? Is -lwebp not linked?
          Compiling and loading the .jpg or png , etc works fine.
          But "WebPConfig config;" If this statement is inserted into the code and debugged,
          The execution window does not even appear and the following message appears in "application output".
          _Qt_6_0_0_MinGW_64_bit-Debug\debug\WebpEditor.exe crashed.

          1 Reply Last reply
          0
          • M MyNameIsQt
            19 Mar 2023, 07:52

            My project loads and displays (jpeg, png) images in several formats. everything works fine.
            In order to add web, I put ".lib" for Windows and Linux in one folder as shown in the picture, and set up and compiled the pro file as above.
            I did "include/encode.h" and "include/decode.h".

            캡처sdf.PNG

            
            win32:CONFIG(release, debug|release): LIBS += -L$$PWD/webp -lwebp
            else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/webp -lwebp
            else:unix: LIBS += -L$$PWD/webp -lwebp
            
            INCLUDEPATH += $$PWD/webp
            LIBS += -L$$PWD/webp
            DEPENDPATH += $$PWD/webp
            
            

            Compiled in MinGW environment. Compilation itself works.
            If I don't link to the .pro file, I get an error, but the compilation doesn't invoke a message like "Cannot find -lwebp".

            So I put the following sentence.
            Compiling at this point crashes and the window doesn't show up.
            If I delete the WebPConfig statement below and recompile it works fine.
            What could be the problem?

            WebPConfig config;
                if (!WebPConfigInit(&config)) {
                    QMessageBox::information(this, "title", tr("Failed initialize WebPConfig."));
                    return false;
                }
            

            I create the project with qmake and debug it in MingGW environment.
            Thanks for your time.

            C Offline
            C Offline
            ChrisW67
            wrote on 20 Mar 2023, 04:05 last edited by ChrisW67
            #4

            @MyNameIsQt said in Include webp.lib to project:

            Compiled in MinGW environment. Compilation itself works.
            and
            Compiling at this point crashes and the window doesn't show up.

            • Compile == each source code file is syntactically correct and complete
            • Link == the object files from compile plus any included libraries produce a result with no undefined references (i.e. between files or libraries)
            • Run == The result of linking can find everything it is dynamically linked to in order to start.

            If the compiler and linker were happy (your first statement) then this sounds like running your program crashes at start. Crashing a compiler or linker is a rare thing.

            The most likely reason for the program failing after adding a new run-time dependency is that the dependency is not met at run-time. The webp.dll (matching the libwebp.a link library) must either be in the current working directory of your running program, on the system PATH, or in one of the few standard locations that Windows looks. If the other libraries in your directory are directly, or indirectly, required then this applies to them as well.

            J 1 Reply Last reply 20 Mar 2023, 08:16
            3
            • C ChrisW67
              20 Mar 2023, 04:05

              @MyNameIsQt said in Include webp.lib to project:

              Compiled in MinGW environment. Compilation itself works.
              and
              Compiling at this point crashes and the window doesn't show up.

              • Compile == each source code file is syntactically correct and complete
              • Link == the object files from compile plus any included libraries produce a result with no undefined references (i.e. between files or libraries)
              • Run == The result of linking can find everything it is dynamically linked to in order to start.

              If the compiler and linker were happy (your first statement) then this sounds like running your program crashes at start. Crashing a compiler or linker is a rare thing.

              The most likely reason for the program failing after adding a new run-time dependency is that the dependency is not met at run-time. The webp.dll (matching the libwebp.a link library) must either be in the current working directory of your running program, on the system PATH, or in one of the few standard locations that Windows looks. If the other libraries in your directory are directly, or indirectly, required then this applies to them as well.

              J Offline
              J Offline
              JonB
              wrote on 20 Mar 2023, 08:16 last edited by JonB
              #5

              @ChrisW67 said in Include webp.lib to project:

              The most likely reason for the program failing after adding a new run-time dependency is that the dependency is not met at run-time.

              Although this is a true statement, and I see others have upvoted your post, I don't see this as the case here for the OP. Once linked against the .lib file for the DLL that DLL will be required by the executable at start up, and if not found it would not run but produce an error when invoked.

              That is not what the OP reports. It looks like the compilation/linking has gone find and the DLL has been found at runtime. (This could be verified by having the WebPConfigInit() call somewhere in code but not actually executing it.) Now the code fails on calling anything WebPConfig. This suggests to me one of the many possible runtime issues suggested in my previous post. If allowed to crash inside the debugger the stack trace might give a clue.

              C 1 Reply Last reply 20 Mar 2023, 22:08
              0
              • J JonB
                20 Mar 2023, 08:16

                @ChrisW67 said in Include webp.lib to project:

                The most likely reason for the program failing after adding a new run-time dependency is that the dependency is not met at run-time.

                Although this is a true statement, and I see others have upvoted your post, I don't see this as the case here for the OP. Once linked against the .lib file for the DLL that DLL will be required by the executable at start up, and if not found it would not run but produce an error when invoked.

                That is not what the OP reports. It looks like the compilation/linking has gone find and the DLL has been found at runtime. (This could be verified by having the WebPConfigInit() call somewhere in code but not actually executing it.) Now the code fails on calling anything WebPConfig. This suggests to me one of the many possible runtime issues suggested in my previous post. If allowed to crash inside the debugger the stack trace might give a clue.

                C Offline
                C Offline
                ChrisW67
                wrote on 20 Mar 2023, 22:08 last edited by
                #6

                @JonB Without knowing exactly what WebPConfigInit is doing internally, who can say. It may be trying to dynamically load one of the other DLLs and failing badly, or returning false and this being called "crashing" by the OP. I agree that more information would be useful.

                M 1 Reply Last reply 21 Mar 2023, 05:17
                0
                • C ChrisW67
                  20 Mar 2023, 22:08

                  @JonB Without knowing exactly what WebPConfigInit is doing internally, who can say. It may be trying to dynamically load one of the other DLLs and failing badly, or returning false and this being called "crashing" by the OP. I agree that more information would be useful.

                  M Offline
                  M Offline
                  MyNameIsQt
                  wrote on 21 Mar 2023, 05:17 last edited by
                  #7

                  @ChrisW67 I don't think this is an error in running WebPConfigInit. Because it doesn't execute the function.

                  1 Reply Last reply
                  0
                  • M MyNameIsQt has marked this topic as solved on 21 Mar 2023, 05:19

                  1/7

                  19 Mar 2023, 07:52

                  • Login

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