<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: kiran thilak</title>
    <description>The latest articles on DEV Community by kiran thilak (@f1r361rd).</description>
    <link>https://dev.to/f1r361rd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F95156%2F987185d7-092f-45b6-b8ae-799495c5c0f1.png</url>
      <title>DEV Community: kiran thilak</title>
      <link>https://dev.to/f1r361rd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/f1r361rd"/>
    <language>en</language>
    <item>
      <title>How I Build a MySql plugin for QT5 (Windows, MinGW32)</title>
      <dc:creator>kiran thilak</dc:creator>
      <pubDate>Mon, 21 Oct 2019 13:28:33 +0000</pubDate>
      <link>https://dev.to/f1r361rd/how-i-build-a-mysql-plugin-for-qt5-windows-mingw32-2kim</link>
      <guid>https://dev.to/f1r361rd/how-i-build-a-mysql-plugin-for-qt5-windows-mingw32-2kim</guid>
      <description>&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Download MySql C Connector v6.1.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Download the MySql Installer from:&lt;br&gt;
  &lt;a href="https://dev.mysql.com/downloads/installer/"&gt;https://dev.mysql.com/downloads/installer/&lt;/a&gt;&lt;br&gt;
  Install C Connector 6.1 (Note the location we will need it later)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Getting QT Source Ready&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To build a plugin for QT u need to get its source. You can install it from Maintenance Tool or manually get it from github repository.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Building Plugin&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;   Open MinGW CMD (Windows -&amp;gt; Start Menu -&amp;gt; Programs -&amp;gt; Qt 5.13.1 -&amp;gt;
5.13.1-&amp;gt; MinGW 7.3.0 (32-bit) -&amp;gt; Qt 5.13.1 (MinGW 7.3.0 32-bit) )&lt;/li&gt;
&lt;li&gt; cd to sqldrivers path in qt source
&lt;/li&gt;
&lt;/ol&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd D:\\QT\\Qt5.13.1\\5.13.1\\Src\\qtbase\\src\\plugins\\sqldrivers
&lt;/code&gt;&lt;/pre&gt;



&lt;ol&gt;
&lt;li&gt;  Run qmake here. &lt;code&gt;qmake sqldrivers.pro&lt;/code&gt; (to create qtsqldrivers-config.pri )&lt;/li&gt;
&lt;li&gt;  cd to mysql.
&lt;/li&gt;
&lt;/ol&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd D:\\QT\\Qt5.13.1\\5.13.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\mysql
&lt;/code&gt;&lt;/pre&gt;



&lt;ol&gt;
&lt;li&gt; Run qmake here. qmake mysql.pro&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Add the plugin to the list&lt;/p&gt;

&lt;p&gt;Once successfully build you will find qsqlmysql.dll and qsqlmysqld.dll in&lt;br&gt;
the following location&lt;br&gt;
&lt;code&gt;D:\QT\Qt5.13.1\5.13.1\Src\qtbase\src\plugins\sqldrivers\plugins\sqldrivers&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Copy both qsqlmysql.dll and qsqlmysqld.dll and place them in the compiler’s&lt;br&gt;
plugin directory&lt;br&gt;
&lt;code&gt;D:\QT\Qt5.13.1\5.13.1\mingw73_32\plugins\sqldrivers&lt;/code&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;/ol&gt;



&lt;p&gt;Error in Building?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Library 'mysql' is not defined.&lt;/p&gt;

&lt;p&gt;In file cd&lt;br&gt;
&lt;code&gt;D:\QT\Qt5.13.1\5.13.1\Src\qtbase\src\plugins\sqldrivers\mysql\mysql.pro&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Commend the line &lt;code&gt;QMAKE_USE += mysql&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Adding Library path and Include path.&lt;/p&gt;

&lt;p&gt;Add the following to mysql.pro at end&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LIBS += -L'C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/lib/'
-llibmysql

INCLUDEPATH += 'C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/include'

DEPENDPATH += 'C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/include'
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;QSqlDatabase: QMYSQL driver not loaded &lt;/p&gt;

&lt;p&gt;Add the .dll files from C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/lib to D:\QT\Qt5.13.1\5.13.1\mingw73_32\bin&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>qt5</category>
      <category>mysql</category>
      <category>plugin</category>
    </item>
  </channel>
</rss>
