How to add an external .a library in Qt Creator project via GUI?

后端 未结 1 1682
栀梦
栀梦 2021-01-19 06:43

I\'ve built yamlcpp static (libyaml-cpp.a) library using Qt\'s mingw compiler. Now I want to add it to my project. I use this qt doc, but Qt Creator allows to select only *

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-19 07:31

    As far as I know it is impossible now. The only way is to edit .pro file and add such lines:

    win32 {
        #/* If you compile with QtCreator/gcc: */
        win32-g++:LIBS += -L"$$_PRO_FILE_PWD_/libs/"
        win32-g++:LIBS += -lyaml-cpp
    
        #/* IF you compile with MSVC:
        #win32-msvc:LIBS += /path/to/your/libMyLib.lib*/
    }
    
    
    macx {
        LIBS += -L"$$_PRO_FILE_PWD_/libs/"
        LIBS += -lyaml-cpp-mac
    }
    

    0 讨论(0)
提交回复
热议问题