title: How to include freetype library to Keil uVision 4?
body: <p>I have to add freetype library to keil uvision 4 for dealing ttf font files.
  I followed the steps in <a href="http://www.freetype.org/freetype2/docs/tutorial/step1.html" rel="nofollow noreferrer">Simple Glyph Loading Tutorial</a>.</p>
  
  <p>I am trying to compile the code below called <a href="http://www.freetype.org/freetype2/docs/tutorial/example1.c" rel="nofollow noreferrer">example1.c</a>. I tried the tutorial in Ubuntu terminal with the help of <a href="https://stackoverflow.com/questions/12312034/c-compiler-error-undefined-reference-to-ft-init-freetype">Undefined reference to 'FT_Init_FreeType'</a>. It compiled without error.</p>
  
  <p>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)."</p>
  
  <p>Can anyone help me?</p>
  
  <hr>
  
  <p><strong><em>example1.c</em></strong>:</p>
  
  <pre><code>/* example1.c                                                      */
  /*                                                                 */
  /* This small program shows how to print a rotated string with the */
  /* FreeType 2 library.                                             */
  
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;math.h&gt;
  
  #include &lt;ft2build.h&gt;
  #include FT_FREETYPE_H    
  
  #define WIDTH   640
  #define HEIGHT  480    
  
  /* origin is the upper left corner */
  unsigned char image[HEIGHT][WIDTH];    
  
  /* Replace this function with something useful. */
  
  void
  draw_bitmap( FT_Bitmap*  bitmap,
               FT_Int      x,
               FT_Int      y)
  {
    FT_Int  i, j, p, q;
    FT_Int  x_max = x + bitmap-&gt;width;
    FT_Int  y_max = y + bitmap-&gt;rows;    
  
    for ( i = x, p = 0; i &lt; x_max; i++, p++ )
    {
      for ( j = y, q = 0; j &lt; y_max; j++, q++ )
      {
        if ( i &lt; 0      || j &lt; 0       ||
             i &gt;= WIDTH || j &gt;= HEIGHT )
          continue;
  
        image[j][i] |= bitmap-&gt;buffer[q * bitmap-&gt;width + p];
      }
    }
  }    
  
  void
  show_image( void )
  {
    int  i, j;
  
    for ( i = 0; i &lt; HEIGHT; i++ )
    {
      for ( j = 0; j &lt; WIDTH; j++ )
        putchar( image[i][j] == 0 ? ' '
                                  : image[i][j] &lt; 128 ? '+'
                                                      : '*' );
      putchar( '\n' );
    }
  }
  
  int
  main( int     argc,
        char**  argv )
  {
    FT_Library    library;
    FT_Face       face;
  
    FT_GlyphSlot  slot;
    FT_Matrix     matrix;                 /* transformation matrix */
    FT_Vector     pen;                    /* untransformed origin  */
    FT_Error      error;
  
    char*         filename;
    char*         text;
  
    double        angle;
    int           target_height;
    int           n, num_chars;
  
    if ( argc != 3 )
    {
      fprintf ( stderr, "usage: %s font sample-text\n", argv[0] );
      exit( 1 );
    }
  
    filename      = argv[1];                           /* first argument     */
    text          = argv[2];                           /* second argument    */
    num_chars     = strlen( text );
    angle         = ( 25.0 / 360 ) * 3.14159 * 2;      /* use 25 degrees     */
    target_height = HEIGHT;
  
    error = FT_Init_FreeType( &amp;library );              /* initialize library */
    /* error handling omitted */
  
    error = FT_New_Face( library, filename, 0, &amp;face );/* create face object */
    /* error handling omitted */
  
    /* use 50pt at 100dpi */
    error = FT_Set_Char_Size( face, 50 * 64, 0,
                              100, 0 );                /* set character size */
    /* error handling omitted */
  
    slot = face-&gt;glyph;
  
    /* set up matrix */
    matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L );
    matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L );
    matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L );
    matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L );
  
    /* the pen position in 26.6 cartesian space coordinates; */
    /* start at (300,200) relative to the upper left corner  */
    pen.x = 300 * 64;
    pen.y = ( target_height - 200 ) * 64;
  
    for ( n = 0; n &lt; num_chars; n++ )
    {
      /* set transformation */
      FT_Set_Transform( face, &amp;matrix, &amp;pen );
  
      /* load glyph image into the slot (erase previous one) */
      error = FT_Load_Char( face, text[n], FT_LOAD_RENDER );
      if ( error )
        continue;                 /* ignore errors */
  
      /* now, draw to our target surface (convert position) */
      draw_bitmap( &amp;slot-&gt;bitmap,
                   slot-&gt;bitmap_left,
                   target_height - slot-&gt;bitmap_top );
  
      /* increment pen position */
      pen.x += slot-&gt;advance.x;
      pen.y += slot-&gt;advance.y;
    }
  
    show_image();
  
    FT_Done_Face    ( face );
    FT_Done_FreeType( library );
  
    return 0;
  }
  </code></pre>