title: Tesseract Example for Iphone
body: <p>I have compiled tesseract for using it in xcode following: <a href="http://iphone.olipion.com/cross-compilation/tesseract-ocr" rel="noreferrer">http://iphone.olipion.com/cross-compilation/tesseract-ocr</a></p>
  
  <p>I obtain the .a file, import it as framework in the iphone project, and update the header search path for tesseract header files.</p>
  
  <p>So now I need a simple example in order to get start.
  I can't find anything in http :// code.google.com/p/tesseract-ocr/ or by googling.</p>
  
  <p>Anyone can help me give me a starting point (a code snippet)..?!
  Many ThankS!</p>
  
  <p>--
  Later i found this code:</p>
  
  <p><code>#include "baseapi.h"</code></p>
  
  <hr>
  
  <p><code>TessBaseAPI::InitWithLanguage(NULL, NULL, language, NULL, false, 0, NULL);
  char* text = TessBaseAPI::TesseractRect(imagedata, bytes_per_pixel,
                                            bytes_per_line, 0, 0,
                                            width, height);
  TessBaseAPI::End();</code></p>
  
  <hr>
  
  <p>but when I try to compile for device (only inserting include statement without the code above) i get the following:</p>
  
  <p>error:syntax error before 'PAGE_RES'
  warning:type defaults to 'int' in declaration of 'PAGE_RES'
  warning:data definition has no type or storage class</p>
  
  <p>and so on with BLOCK_LIST, IMAGE etc.</p>
  
  <hr>
  
  <p>if compile for simulator i get</p>
  
  <p>error: expected '=',',',','asm' or '<strong>attribute</strong>' before 'PAGE_RES'
  and so on with BLOCK_LIST, IMAGE and TessBaseAPI</p>
  
  <p>--- Other Update:
  I found solution for include problem:
  Where the include occurs must be rename the file.m in .mm extension because we have to tell xcode that we have to use objective-c and c++ together.</p>