Import C Library in Atollic TrueStudio, STM32CubeM

2019-07-30 21:31发布

问题:

I am currently working on a STM32F767ZI-Nucleo board and a little security chip (microchip atecc508a), that is connected via i2c connection. For this chip is a library available CryptoAuthLib, that I want to use in my project. I'm also using STM32CubeMX to generate my C-Files and Atollic TrueStudio to write my implementations.

C programming language is relatively new to me, so I have no idea how to include my library folder to my project (either in cubemx or in trustudio?) to get it work.

I think the include statement #include "cryptoauthlib.h" should be in the main.c include section, but in a certain way I have to tell the IDE to use this library.

I appreciate any help, thank you very much.

回答1:

Create a folder inside your project. You have to declare to IDE have header files (.h) and souce files (.c) are inside that folder. To do this, open properties of project and in C/C++ general>Paths and Symbols. In the Include tab add the folder that contains the header files. In the Source Location Tab add folder that contains the source code file. Aplly then OK. Clean and Rebuild the project. Then you can include in the main.c. Hope this helps. Best Regards.