title: Include static external library in QT4 application
body: <p>Newish C++ programmer here. I am creating a QT4 application and it's gotten large enough to where I want to start using log4cplus. I think I'm close but qmake is still not cooperating.</p>
  
  <p>I am running on a Windows machine, and I compiled log4cplus as a static library under cygwin (<code>$ ./configure --enable-static</code>).</p>
  
  <p><strong>First Question</strong><br>
  When I compiled log4cplus I got two files.</p>
  
  <ul>
  <li>liblog4cplus.a</li>
  <li>liblog4cplus.dll.a</li>
  </ul>
  
  <p>Do I need to include both of them? What's with the <code>.dll.a</code> file?</p>
  
  <p><strong>Second Question</strong><br>
  When I compile moc succeeds but gcc fails when trying to use any of log4cplus classes. I'm not sure if it can't find the header files or if it can't find the actual library.</p>
  
  <pre><code>g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\Qt\2010.05\qt\include\QtCore" -I"..\..\..\Qt\2010.05\qt\include\QtGui" -I"..\..\..\Qt\2010.05\qt\include" -I"external" -I"..\..\..\Qt\2010.05\qt\include\ActiveQt" -I"debug" -I"..\..\..\Qt\2010.05\qt\mkspecs\win32-g++" -o debug\qrc_tilex.o debug\qrc_tilex.cpp
  g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\tilex.exe object_script.tilex.Debug  -L"c:\work\workspace\tilex\lib" -L"c:\Qt\2010.05\qt\lib" -lmingw32 -lqtmaind -Lliblog4cplus.a -lQtGuid4 -lQtCored4 
  ./debug\main.o: In function `Z5qMainiPPc':
  C:\work\workspace\tilex/main.cpp:37: undefined reference to `log4cplus::Logger::getDefaultHierarchy()'
  C:\work\workspace\tilex/main.cpp:37: undefined reference to `log4cplus::BasicConfigurator::BasicConfigurator(log4cplus::Hierarchy&amp;)'
  C:\work\workspace\tilex/main.cpp:51: undefined reference to `log4cplus::BasicConfigurator::~BasicConfigurator()'
  C:\work\workspace\tilex/main.cpp:51: undefined reference to `log4cplus::BasicConfigurator::~BasicConfigurator()'
  mingw32-make[1]: Leaving directory `C:/work/workspace/tilex'
  collect2: ld returned 1 exit status
  mingw32-make[1]: *** [debug\tilex.exe] Error 1
  mingw32-make: *** [debug] Error 2
  </code></pre>
  
  <p>My project resides in <code>C:\work\workspace\tilex</code>.</p>
  
  <p>and my directory structure is this:</p>
  
  <pre><code>tilex
       /lib
           /&lt;*.a files&gt;
       /external
                /log4cplus
                          /&lt;header files&gt;
  </code></pre>
  
  <p>Relevant portion of my .pro file. (I've tried several permutations of all these variables, and still get the same result)</p>
  
  <pre><code>INCLUDEPATH += C:\\work\\workspace\\tilex\\external
  QMAKE_LIBDIR += C:\\work\\workspace\\tilex\\lib
  LIBS += -Lliblog4cplus.a
  </code></pre>
  
  <p>My main file (which compiles and runs fine without log4cplus).</p>
  
  <pre><code>#include "Tilex.h"
  #include &lt;QtGui&gt;
  #include &lt;QApplication&gt;
  
  #include &lt;log4cplus/logger.h&gt;
  #include &lt;log4cplus/configurator.h&gt;
  
  using namespace log4cplus;
  
  int main(int argc, char *argv[])
  {
      Q_INIT_RESOURCE(tilex);
      QApplication app(argc, argv);
  
      // Fails
      BasicConfigurator config;
  //    config.configure();
  //    Logger::getInstance()
  //    Logger logger = Logger::getInstance("main");
  //    LOG4CPLUS_WARN(logger, "Hello, World!");
      // !
  
      Tilex mainWin;
      mainWin.show();
      return app.exec();
  }
  </code></pre>