Congratulations to our 2022 Qt Champions!

Library linking problem with openCV

  • I am trying to run a sample code from OpenCV to ensure my library is linked properly. However, i am unable to find the dll or dll.a files when i right click on the project folder to add libraries., although they exist.

    However, if i manually add libraries for my .pro file as shown, the project is able to build and run properly through the IDE.

    Even so, i am unable to run the executable file directly without the ide with this error as shown.

    Can someone tell me what is going on here? I have no clue. I guess i am using a static library with the .a files so why can't i run the executable file without running into run time error?

  • Programming basic: you need the dlls with the exe or in you PATH.
    If you run from the IDE, it will set the PATH for you (from the LIBS).
    And no, you are not linking static library, if yes they won't be called "*.dll.a".
    About the first picture, I think you've clicked the wrong button, because it seems to want a folder, not files.

  • @Bonnie So dll.a files are considered dynamic? I have a binary folder with dll files & exe files. Also i have a lib folder with dll.a files. Which one should i include?

  • @Shane00
    .a files are just like .lib files, it might be a static library, or it might be used to import a dynamic-link library.
    From its name you can see it is the latter.
    So you need to link the .dll.a files in the .pro file to create your exe file and when running the program you need .dll files.
    And what you need to "include" are the header files.

Log in to reply