title: Eclipse, best way to build shared library?
body: <p>I am rather new with C++ and using eclipse. </p>
  
  <p>I have a <strong>Native C++ Static Library</strong> with a C++/CLI Wrapper in Visual Studio 2012.</p>
  
  <p>Now I am building the Native C++ code in Linux with <strong>Eclipse</strong> (Juno Service Release 2) and <strong>GCC 4.2.4.</strong></p>
  
  <p>I created a <strong>Shared Library Empty Project in Eclipse</strong> and added all my .h and .cpp files, and let Eclipse do the building. However I got the error</p>
  
  <pre><code>relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
  </code></pre>
  
  <p>I added the <strong>-fPIC</strong> flag in Project->Settings->GCC C++ Compiler-> Miscellaneous-> Other Flags.</p>
  
  <p>I don't know anyone proficient using Linux/Eclipse so I am not sure I took the best path.</p>
  
  <p>Is there a best/"more correct" way to build a shared library than the way I just described?
  Are there any issues to the approach I took?</p>