If you load up Exercise 5.2 and try to run it you will find that it fails to compile. You get the error:
assembler error:
Function code '_lcd_start' not found
assembler error:
Function code '_lcd_print' not found
Build failed
This is because although we have generated proper calls the the functions at the moment they cannot be found when the program is actually to be constructed. You can split the building of a program down into two chunks:
-
Compile the source files which are required
-
Link them into a single program
We have taken steps to make sure that the first step succeeds, now we have to make sure that the second works as well. To do this we have to tell the compiler where to look for the lcdlib functions. We do this by creating a project file which gives SourceBoost the names of all the source files to be used to build the project, and the name of the assembler file to be created. On the right you can see the sequence to use to create the project "first.__c" which lets us use the lcd library with Program 5.2.
Create a new project file (first.__c) and add the Program 5.2 file (ex52.c) and the lcdlib.c file. Compile and run the project.
As we develop code which is useful we will put it into libraries for use later.
Making a SourceBoost Project File
Open the New Project menu:
Give a filename for your new project (I called mine first.__c) :
Add the sources for the project using the 'Add files' option :
This should produce a workspace looking something like this :
Note that my C programs are in the directory C:\Matrix\C4PICs\c, yours may be somewhere else. Some programmers put all their library files in a particular directory so that they can organise their work properly. This is a good idea.
You are now working with a project. When you press the Compile button SourceBoost will use all the source files it has been given to build your program.