Search code examples
qt5static-linkingqmake

How to make intermediate object file not a library using qmake?


Filesystem layout:

MyProject
|_ myproject.pro
|_ FuncA
   |_ core.cpp
   |_ core.h
   |_ core.pro
|_ app
   |_ main.cpp
   |_ app.pro

I want just to compile "core.cpp" in FuncA to make a object file not a library. That is "gcc -c core.cpp". And in app I want to make main program linking core.o created previously.

In this case how do I make core.pro? Which TEMPLATE should I use?


Solution

  • I solved this problem with "static library config" so that it will not make ".so" libs and then link that static library with main program.

    TEMPLATE = lib
    CONFIG += staticlib