How to add object files to a project in Qt

后端 未结 2 1321
自闭症患者
自闭症患者 2020-12-19 19:53

Currently the linker in one project has problems linking to object files generated by source files in another project. Is there some way to manually add those object files t

相关标签:
2条回答
  • 2020-12-19 20:03

    Building on ismail's answer, if you have a directory with many object files, you don't have to include each one separately. You can just write:

    LIBS += "../path-to-objs/*.obj"
    

    You can also specify different object files to link against for debug and release builds with:

    Release:LIBS += "../path-to-objs/Release/*.obj"
    Debug:LIBS += "../path-to-objs/Debug/*.obj"
    

    I include this because my MSVC linker complains when the specified object files don't match the build type (release/debug).

    0 讨论(0)
  • 2020-12-19 20:19

    Try using the LIBS directive in your *.pro file;

    LIBS += /path/to/foo.o
    
    0 讨论(0)
提交回复
热议问题