How to add Static library in Project

Hi All,

I am beginner in development on Nordic product.

I am using sdk v1.5.1 and nrf5340 for development.

I want to add open source library libcorrect.a for Forward error correction in my project.But i am not getting how to add libcorrect.a in my project.

Can some one guide me how to add .a file in Cmake file?

I tried the solution given in https://devzone.nordicsemi.com/f/nordic-q-a/39338/segger-studio-static-library-adding-to-linker .but its giving me the error "undefined response to" functions available in libcorrect.a

Any help will be appreciated.

Thanks!

Parents Reply Children
  • Hi,

    Thanks for the response.

    i have added following line in cmake file-

    target_link_libraries(app PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../common/lib/libcorrect.a)

    it is giving me following error on compilation

    i have only one file(header) associated with library.whose path i have added in in cmake which is in another directory.Do i need to keep .a file and associated header in same directory?

    Regards.

  • Well, from the message it is not clear, which tool is emitting the error message. Usually, it should be your linker and from the error message, it looks like, that the library that you are using is build for /from a different tool chain (aka compiler + linker).

    Do get a better overview, you might try to invoke cmake / make from your command line. If you prepend `VERBOSE=1 ` to your make invocation, you will see which tool exactly is complaining and how this tools was invoked.

Related