I have to add freetype library to keil uvision 4 for dealing ttf font files. I followed the steps in http://www.freetype.org/freetype2/docs/tutorial/step1.html .
I am trying to compile this code. example1.c
I tried the tutorial in Ubuntu terminal with the help of C compiler error: Undefined reference to 'FT_Init_FreeType' . It compiled without error.
But unfortunately I don't know how to link the library to keil. It shows "Error: L6218E: Undefined symbol FT_Init_FreeType (referred from example1.o)."
Can anyone help me?
Best How To :
Create a new project "freetype". In the project settings change the "Output" to a static library:
Add the freetype sources to the project, and build. Do not use your "amalgamated" source file - that will destroy the library granularity and lead to excessively large code.
Add the resulting freetype.lib file to your application project. The linker will select only those modules from the library that are necessary to resolve references in your application thus keeping size to a minimum.
You may get smaller code size from including the freetype source directly in your application and using cross-module optimisation (this will work regardless of the use of separate compilation or the amalgamated file); however the build time may be excessive as it requires repeated full-builds to fully optimise. Note that unlike compiler-optimisation, cross-module optimisation does not affect the debugging experience - you can use the debugger normally even with it enabled.
EDIT : The cross-module optimisation feature may not apply when using the GNU toolchain; it refers to the use of Keil MDK-ARM which uses ARM's RealView toolchain. Other aspects of this answer may also be applicable only to MDK-ARM.