Important: Please read the Qt Code of Conduct -

[SOLVED] Library inclusion problem

  • I'm using winpcap library in my project. The folder of this library resides inside my project folder (where my .pro file is). It works fine if I include this library in .pro file by writing full path like this:

    LIBS += "C:/.../.../.../.../.../My_project/WpdPack/Lib/wpcap.lib"

    However, I'm constantly going between several different machines. This forces me to edit path in .pro file each time I arrive to another PC. This is inconvenient, so I'd like to make it so qmake automatically searches for my libraries inside my project folder. All my attempts to do so have failed so far.

    I've tried this:

    LIBS += -L/My_project/WpdPack/Lib/ -lwpcap \

    but I get LNK1104 error in Windows compiler, telling me it can't open 'wpcap.lib'.

    I've also tried this and it failed with same error:

                   some_folder  \
                   another_folder  \
                   WpdPack/Include \
    LIBS += -lwpcap -lPacket

  • Lifetime Qt Champion


    You should use $$PWD not just $PWD

    LIBS += -L$$PWD/WpdPack/lib

  • Thanks, it worked.

  • Lifetime Qt Champion

    You're welcome !

    Since it's working now, please mark the thread as solved so other forum users may know a solution has been found :)

Log in to reply