Jump to content

Recommended Posts

Hello ,

 

Please I need help on how to create a library using boostc and then how to use or include the library file in any of my boostc projects.

How do I compile the library file.

 

Do I need to install the library file in a special directory in the program directory ?

 

 

Thank you,

Kawall

Share this post


Link to post
Share on other sites

To build (compile) a library, goto "Settings -> Options...", select Output Type: Library radio button.

 

To add a library to your project, goto the Workspace (project) window (left of screen usually), right click and add the .lib file you want to include.

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites
To build (compile) a library, goto "Settings -> Options...", select Output Type: Library radio button.

 

To add a library to your project, goto the Workspace (project) window (left of screen usually), right click and add the .lib file you want to include.

 

Cheers

 

Reynard

 

Hi ,

this is my test library I am trying build:--

 

include <system.h>

volatile bit row1port @7.1;

 

rom char* keyPadMatrix =

{

'1','2','3',

'4','5','6',

'7','8','9',

'*','0','#',

0xFF

 

} ;

 

 

char ScanKeyMatrix()

{

char key = 0, row;

 

for( row = 10; row < 1; row -- )

{

 

// do some code

}

 

 

return keyPadMatrix[ key ];

}

 

//---------------------

below I am trying to us the library file :---

 

 

include <system.h>

 

//#include <test.h>

 

//Target PIC16F628 configuration word

#pragma DATA _CONFIG, _PWRTE_OFF & _WDT_OFF & _HS_OSC & _CP_OFF

 

 

void interrupt( void )

{

 

 

 

if( intcon & (1<<T0IF) )

{

clear_bit( intcon, T0IF );

}

 

 

}

 

void main( void )

{

 

ScanKeyMatrix();

 

while( 1 );

 

}

 

 

//-------------

below is the error I get :--

Building...

 

TS.c

 

failure

C:\C_files\boostc_project\scrap_lib_k\testing_lib\TS.c(25:2): error: unknown identifier 'ScanKeyMatrix'

C:\C_files\boostc_project\scrap_lib_k\testing_lib\TS.c(25:2): error: failed to generate expression

"C:\Program Files\SourceBoost\boostc.pic16.exe" TS.c -t PIC16F628

Exit code was 1.

Removing target: TS.obj

Done

Share this post


Link to post
Share on other sites

I think Renard left out a subtle point in that most libraries need not only a .lib but also a .h which defines the function prototypes that the library contains. Then, the user of the library would also include the .h file in the source that is using it so that the compiler knows what to expect. This is the same as if you have multiple files in a stand-alone compile.

 

KeyLib.h

---------------------------------

char ScanKeyMatrix(void);

 

 

main.c

-------------------------

#include "KeyLib.h"

 

......

Edited by trossin

Share this post


Link to post
Share on other sites
I think Renard left out a subtle point in that most libraries need not only a .lib but also a .h which defines the function prototypes that the library contains. Then, the user of the library would also include the .h file in the source that is using it so that the compiler knows what to expect. This is the same as if you have multiple files in a stand-alone compile.

 

KeyLib.h

---------------------------------

char ScanKeyMatrix(void);

 

 

main.c

-------------------------

#include "KeyLib.h"

 

......

 

 

Well thank you.

 

in my case I build a file name "test" as a library and I check for a file name test.h afterward .. none was found.

Share this post


Link to post
Share on other sites

Header files (.h) are not generated automatically. You have to build them yourself.

 

Open a blank page. Insert you function prototypes as trossin says (char ScanKeyMatrix(void):). Save the file as test.h

 

You now have your .h file to match your .lib file.

 

Cheers

 

Reynard

 

Remember: If you use #include <test.h> , the compiler expects the .h file to be in the ...\SourceBoost\include directory.

Use #include "test.h" if the header is in your local project directory. Or just use the full path name.

Edited by Reynard

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...