Adding library to existing project

If you have a simple question and just want an answer.
User avatar
Automatyk
Member
Posts: 13
Joined: Thu Jul 30, 2015 12:10 pm

Adding library to existing project

Post by Automatyk »

Hi there,

I created my own project and I would like to add some libraries to it. For example, I found GPIO library in Libraries window and then I added it to my Project Explorer window, but I don't know how am I supposed to add gpio.h library to my project. I tried to move gpio.h file from the lib_gpio project to src folder in project that I had created before, but there were some errors during the buld of this project.

I'm using xTIMEcomposer v. 14

I would be very thankful if anybody could tell me how to solve this problem.

sorry for my bad eanglish :)



 

User avatar
Automatyk
Member
Posts: 13
Joined: Thu Jul 30, 2015 12:10 pm

Post by Automatyk »

Ok I solved this problem. I've forgotten to add gpio.xc into src folder of my project :P Additionali I had to add also xassert.h library. Now it all works fine :)

 

srinie
XCore Addict
Posts: 158
Joined: Thu Mar 20, 2014 8:04 am

Post by srinie »

It is very simple to add a library to your application.

 

Step 1: in general, locate the <xyz_lib>.h from <lib_xyz/api> folder; and include in your *.xc file

e.g:,           #include <gpio.h> //in main.xc file

 

Step 2: Add the library in your make file

e.g:,          USED_MODULES = lib_gpio   //to the Makefile in your app_* folder