title: How can I use C++ with Objective-C in XCode
body: <p>I want to use/reuse C++ object with Objective-C.
  I have a hello.h that has the class definition, and hello.cpp for class implementation.</p>
  
  <pre><code>class Hello
  { int getX() ... };
  </code></pre>
  
  <p>And I use this class in Objective-C function.</p>
  
  <pre><code>#include "hello.h"
  ...
  - (IBAction) adderTwo:(id)sender
  {
      Hello *hi = new Hello();            
      int value = hi-&gt;getX();
      NSLog(@"Hello %d", value);
      [textField setIntValue:value];
  </code></pre>
  
  <p>When I compile the code in Xcode, I get this error message.</p>
  
  <pre>
  class Hello *XXXXX
  Users/smcho/Desktop/cocoa/adderTwo/hello.h:9:0
  /Users/smcho/Desktop/cocoa/adderTwo/hello.h:9: 
  error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Hello'
  </pre>
  
  <p>What went wrong? </p>