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. How to include library in a local directory in build?
Forum Updated to NodeBB v4.3 + New Features

How to include library in a local directory in build?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 490 Views 1 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.
  • K Offline
    K Offline
    kitfox
    wrote on last edited by
    #1

    I'm trying to link to a third party library. I'd like to configure LIBS to refer to a local directory. When I use an absolute path (the first line below), I can link. However my other attempts to link in a local directory are failing.

    What is the syntax to include a local directory in LIBS?

    win32 {
    LIBS += -LD:\bin\ffmpeg-20190403-b131a07-win32-dev\lib
    #LIBS += -L./thirdParty/ffmpeg/win32/lib
    #LIBS += -LthirdParty/ffmpeg/win32/lib
    LIBS += -lavcodec -lavformat -lavutil -lswscale -lswresample
    }
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Did you try with
      LIBS += -L$$PWD/thirdParty/ffmpeg/win32/lib

      That is assuming that thirdParty is a subfolder to the folder where the .pro file is.

      1 Reply Last reply
      3
      • K Offline
        K Offline
        kitfox
        wrote on last edited by
        #3

        That worked!

        mrjjM 1 Reply Last reply
        1
        • K kitfox

          That worked!

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @kitfox
          Super.
          The reason the
          #LIBS += -L./thirdParty/ffmpeg/win32/lib
          #LIBS += -LthirdParty/ffmpeg/win32/lib

          didn't work is that - at the time of invocation of the linker, the current directory is
          likely the build folder so the linker would try to find the libs relative to that folder.

          However, $$PWD is "where .pro file is" and hence the relative path can then work.

          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