Creating library projects
Note: This FAQ applies to Code Red IDE version 3.x. For Code Red IDE version 4.x, please see the FAQ "Enhanced Static Library Support in Code Red IDE v4".
Sometimes it is useful to be able to share code between several application projects. A good way to do this is to place the shared code into a library project. Several of the supplied examples make use of such library projects (for example the CMSIS library projects for Cortex-M based MCUs, and the RDB1768 LCD Library project).
You can create such a project yourself using the "Create C Static Library project" entry in the Quickstart Panel view:
This will then launch a project wizard allowing you to name your library project and select the MCU that it is being built for.
Once the library project has been created, you will then probably want to create subdirectories within it to contain the source code and any header files.
To do this, right click on the library project in the Project Explorer view and select New -> Source folder from the context sensitive menu, and call this, say, src.
Then right click again on the library project in the Project Explorer view and select New -> Folder from the context sensitive menu, and call this, say, inc.
If you need the source files in the library project to reference the header files in this inc directory, then you will need to modify the project include paths. To do this, select:
Project Properties -> C/C++ Build -> Settings -> MCU C Compiler -> Directories
and add ../inc to the paths. Remember to do this for all build configurations (typically Debug and Release).
You should then be able to build your library project. To access your library project from other projects in your workspace, see the FAQ Using library projects from your own projects.