Using a static library in Qt Creator

后端 未结 5 957
野趣味
野趣味 2020-12-04 12:35

I\'m having a hell of a time finding documentation which clearly explains how to use a static library in Qt Creator.

I\'ve created and compiled my static library usi

5条回答
  •  半阙折子戏
    2020-12-04 13:18

    The variant

     LIBS += -L[PATH_TO_LIB_DIR] -l[LIBNAME] 
    

    doesn't work if you have both static libLIBNAME.a and dynamic libLIBNAME.so libs in the same folder PATH_TO_LIB_DIR.
    In this case on my linux with QMake v 3.0 the dynamic one is linked by default.
    To force linkage with static one you need to specify it explicitly without any options.

    LIBS += PATH_TO_LIB_DIR/libLIBNAME.a
    

提交回复
热议问题