title: Issue in Compling C++ method in Eclipse and calling C++ method from python
body: <p>Simple C++ example class I want to talk to in a file called foo.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  </code></pre>
  
  <p>Since ctypes can only talk to C functions, you need to provide those declaring them as extern "C"</p>
  
  <pre><code>extern "C" {
      Foo* Foo_new(){ return new Foo(); }
      void Foo_bar(Foo* foo){ foo-&gt;bar(); }
  }
  
  class Foo{
      public:
          void bar(){
              std::cout &lt;&lt; "Hello" &lt;&lt; std::endl;
          }
  };
  </code></pre>
  
  <p>compile this to a shared library</p>
  
  <pre><code>g++ -c -fPIC foo.cpp -o foo.o
  g++ -shared -Wl,-soname,libfoo.so -o libfoo.so  foo.o
  </code></pre>
  
  <p>finally I have wrote python wrapper </p>
  
  <p>from ctypes import cdll
  lib = cdll.LoadLibrary('./libfoo.so')</p>
  
  <pre><code>class Foo(object):
        def __init__(self):
            self.obj = lib.Foo_new()
  
        def bar(self):
            lib.Foo_bar(self.obj)
  f = Foo()
  f.bar() #prints "Hello" on the screen
  </code></pre>
  
  <p>"My main intension is to compile C++ code in eclipse and call the C++ function from python in Linux". This works fine when I compiled C++ code in Linux and call the C++ method from python in Linux. But it doesn't work if I compile C++ code in eclipse and call the C++ method from python in Linux. </p>
  
  <pre><code>Error message:
  
  symbol not found
  </code></pre>
  
  <p>I am new to the eclipse tool chain, But I am giving compiler option and linking option in as in this<br>
  g++ -c -fPIC foo.cpp -o foo.o
  g++ -shared -Wl,-soname,libfoo.so -o libfoo.so  foo.o</p>
  
  <p>Snapshot of eclipse compiler option and linking option will be highly appreciated. Please help me in sorting out this issue. Thanks in advance</p>