Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Osx include files installed with brew



  • I want to use libssh in my QT project.

    I installed it with brew install libssh. Then I did #include <libssh/libssh.h> and trying to compile.
    However the file could not be found, so I guess I need to link to my brew path somehow.

    How can I include /usr/local/Cellar/libssh/0.7.5 into my project?

    edit
    http://doc.qt.io/qtcreator/creator-project-qmake-libraries.html <- adding library in the creator does not work as nothing happens. Even including the full relative path does not work
    #include <../../usr/local/Cellar/libssh/0.7.5/include/libssh/libssh.h>

    for libssh I also have libssh.a and libssh.dylib in /usr/local/lib/

    thanks



  • Ok adding following did the trick for me

    INCLUDEPATH += /usr/local/include/
    LIBS += -L /usr/local/lib/ -lssh 
    


  • Ok adding following did the trick for me

    INCLUDEPATH += /usr/local/include/
    LIBS += -L /usr/local/lib/ -lssh 
    


  • i use this .pro snippet (change gmp w/ssh) or what so ever.

    GMP=/usr/local/Cellar/gmp/6.2.0 # GMP brew location
    INCLUDEPATH += $${GMP}/include
    macx: LIBS += -L$${GMP}/lib -lgmp

    or in a more general form:

    lib=gmp
    lib_loc=$$system(/usr/local/bin/brew --prefix $${lib})
    INCLUDEPATH += $${lib_loc}/include
    macx: LIBS += -L$${lib_loc}/lib -l$${lib}


Log in to reply