Noob at librarys



  • Hey guys. So please forgive the my noobness. I thought I was decent at programing until I came into contact with librarys.

    Anyway here is where im at. I want to use libxbee to communicate with a xbee via serial. It comes in a pre compiled package that all I have to do is include it. Well there is the problem. Ive tried LIBS += -L./Src/Include/libxbee_3.0.7/libs/libxbee.so.3.0.7 but I still get an error compiling saying undefined refrence to xbee_setup()... What am I doing wrong? Mind you Ive never used a downloaded library before so im still trying to understand what to do. If anyone has experence with this, I would appriciate a nudge.

    Thanks in advance


  • Moderators

    You need to use both -L and -l. Here is a snippet for you:
    @
    INCLUDEPATH += path/to/lib/headers
    LIBS += -Lpath/to/lib/folder -llibraryName
    @

    Don't add stuff like .so.xx - it's added automatically by linker. "Here":https://github.com/sierdzio/qeasyshell/blob/master/examples/basic/basic.pro is a live example from one of my projects.



  • Thank you! It all worked out. thanks for the simplicity.


  • Moderators

    I'm happy to hear that. Please add [Solved] to the beginning of this topic's subject.

    Happy coding!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.