title: Creating c++ library in Qt
body: <p>I'm new in linux and Qt and I'm trying to create c++ library in Qt.
  I have library called imaglib with several classes in it. I have done this so far:</p>
  
  <p>imaglib_global.h:</p>
  
  <pre><code>#ifndef IMAGLIB_GLOBAL_H
  #define IMAGLIB_GLOBAL_H
  
  #include &lt;QtCore/qglobal.h&gt;
  
  #if defined(IMAGLIB_LIBRARY)
  #  define IMAGLIBSHARED_EXPORT Q_DECL_EXPORT
  #else
  #  define IMAGLIBSHARED_EXPORT Q_DECL_IMPORT
  #endif
  
  #endif // IMAGLIB_GLOBAL_H
  </code></pre>
  
  <p>imaglib.h:</p>
  
  <pre><code>#ifndef IMAGLIB_H
  #define IMAGLIB_H
  
  #include "imaglib_global.h"
  #include "imagClass.h"
  
  class IMAGLIBSHARED_EXPORT IMaglib
  {
  
  public:
      IMaglib();
  };
  
  #endif // IMAGLIB_H
  </code></pre>
  
  <p>imagClass.h:</p>
  
  <pre><code>#include "imaglib_global.h"
  
  class IMAGLIBSHARED_EXPORT imagClass
  {
  
  public:
      imagClass();
  
      void ImagOperation();
  
      // Other data goes here
  };
  
  // there are several imag classes
  </code></pre>
  
  <p>When I build this it works and creates, in a debug folder .o files and .so, .so.1, .so.1.0 and .so.1.0.0 but when I try to include this in a application it doesn't work. I've tried to copy these files in a folder called imagLib in my project and added this code in application.pro file:</p>
  
  <pre><code>TARGET = MyApp
  TEMPLATE = app
  
  DEPENDPATH += imagLib
  INCLUDEPATH += imagLib
  LIBS+=  -L imaglib/debug -llibiMaglib 
  // It creates libiMaglib.so file so I thought I should use this one but it gives me error on compilation "cannot find -llibiiMaglib"
  </code></pre>
  
  <p>After that I've tried to build library from terminal:</p>
  
  <pre><code>ar crv imaglibrary.so imaglib.o imagClass.o
  </code></pre>
  
  <p>but it gives me same error when I try to build application with imaglibrary.so and it gives me the same error. How to fix this?</p>
  
  <p>EDIT</p>
  
  <p>I have also tried to create .lib file in terminal and include it in application.pro file like .so file shown above. It works but it gives me different error:</p>
  
  <p>"undefined reference to imagClass::ImagOperation()" when I try to create object and call it from code.</p>