title: How to link a dynamic library in QtCreator use qmake and MinGW32?
body: <p>I am trying to use hiredis and libevent in my project, I downloaded their source code and compiled them with CmakeGUI and MinGW32. Then i got the header files and those library files.</p>
  <ul>
  <li>libevent.a</li>
  <li>libevent.dll</li>
  <li>libevent.dll.a</li>
  <li>libevent_core.a</li>
  <li>libevent_core.dll</li>
  <li>libevent_core.dll.a</li>
  <li>libevent_extra.a</li>
  <li>libevent_extra.dll</li>
  <li>libevent_extra.dll.a</li>
  <li>libhiredis.dll</li>
  <li>libhiredis.dll.a</li>
  </ul>
  <p>Then I wrote some test programs to use these libraries, but could not link successfully
  The error looks like this:</p>
  <pre><code>error: undefined reference to `redisConnect'
  </code></pre>
  <p>here is my pro file and code.</p>
  <pre class="lang-sh prettyprint-override"><code>#my pro file
  #hiredis
  INCLUDEPATH += $$PWD/include/hiredis
  LIBS += -L$$PWD/lib/ -llibhiredis.dll
  
  #event2
  INCLUDEPATH += $$PWD/include/libevent
  LIBS += -L$$PWD/lib/ -llibevent.dll
  LIBS += -L$$PWD/lib/ -llibevent_core.dll
  LIBS += -L$$PWD/lib/ -llibevent_extra.dll
  </code></pre>
  <pre class="lang-cpp prettyprint-override"><code>#include &quot;hiredis.h&quot;
  
  MainWindow::MainWindow(QWidget *parent)
      : QMainWindow(parent)
      , ui(new Ui::MainWindow) {
      ui-&gt;setupUi(this);
      redisContext *asd = redisConnect(&quot;127.0.0.1&quot;, 6379);
  }
  </code></pre>
  <p>This is the compile output</p>
  <pre><code>g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release\Test.exe release/main.o
  release/mainwindow.o release/moc_mainwindow.o 
  -LC:\Users\VC\Desktop\Test\lib C:\Users\VC\Desktop\Test\lib\libhiredis.dll.a 
  C:\Users\VC\Desktop\Test\lib\libevent.dll.a 
  C:\Users\VC\Desktop\Test\lib\libevent_core.dll.a 
  C:\Users\VC\Desktop\Test\lib\libevent_extra.dll.a 
  D:\Work\env\cpp\Qt\5.12.9\mingw73_32\lib\libQt5Widgets.a 
  D:\Work\env\cpp\Qt\5.12.9\mingw73_32\lib\libQt5Gui.a 
  D:\Work\env\cpp\Qt\5.12.9\mingw73_32\lib\libQt5Core.a 
  -lmingw32 D:\Work\env\cpp\Qt\5.12.9\mingw73_32\lib\libqtmain.a
  -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.6.11-win32\lib 
  -LC:\Utils\postgresql\pgsql\lib -lshell32 
  
  release/mainwindow.o:mainwindow.cpp:(.text+0x2c9): undefined reference to `redisConnect'
  </code></pre>
  <p>I tried two different libraries(libevent and hiredis) and got similar results, what am I doing wrong?</p>
  <p>thank you</p>