Creating Libraries in mikroC

General discussion on mikroC.
Locked
Author
Message
User avatar
marko.ziv
mikroElektronika team
Posts: 530
Joined: 06 Dec 2007 10:11
Contact:

Creating Libraries in mikroC

#1 Post by marko.ziv » 17 Jun 2008 12:25

Hi,

we had a request to put this as a sticky to be available to all forum users.

Here are the steps for creating a library:

1) Create new C file (mikroC->File->New)
2) Save the file in one of the following folders:
C:\Program Files\Mikroelektronika\mikroC\Uses\P16\
C:\Program Files\Mikroelektronika\mikroC\Uses\P18\
If you are creating library for PIC16 MCU family the file should be saved in P16 folder.
If you are creating library for PIC18 MCU family the file should be saved in P18 folder.
If you are creating library for PIC16 and PIC18 MCU families the file should be saved in both folders.
3) Write the code for your library and save it
4) Open the "mlk" file for the MCU that you want to use. The "mlk" file is placed in the following folder:
C:\Program Files\Mikroelektronika\mikroC\defs\
Add the following line in the definition file for the MCU:
#pragma SetLib(Your_Lib_ Name)
note: this step should be repeated for each MCU that you intend to use
5) Restart the compiler

Best regards

Locked

Return to “mikroC General”