LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

MySQL without using SQL toolkit

Hi,

I wanted to use MySQL database with CVI 2015. I have downloaded and installed MySQL Server 5.7 and able to connect and execute queries through workbench. I included the header file mysql.h and added mysqlclient.lib to the project.

mysqlclient.lib is available after installation of MySQL and i have not compiled and created this file.

When I try to compile the project it throws below error.

  "mysql.h"(35,10)    fatal error: 'sys/types.h' file not found

It seems linking error to me.

Can somebuddy suggest me how to fix this error.

0 Kudos
Message 1 of 3
(2,849 Views)

You will likely have to do some handediting to the mysql.h header file to work around certain include file issues that are different between some C compilers.

 

#ifdef _CVI_
typedef something clock_t;
more defines
#else
#include <sys/types.h>
#endif

sys/types.h is an Open Group Standard header, not something that is defined by ANSI C. LabWindows does not implement or support all the possible OGS, POSIX and what else interfaces and therefore doesn't have headers for most of them.

 

Depending what your mysql header file needs as definitions, you may actually find them in the ansi header files so that including <ansi_h.h> might be enough in this case. size_t, clock_t, time_t and struct tm are for instance defined in the ansi/time.h header file.

 

But even if this works you might want to make sure that the definition in the CVI headers matches with the definitions of MS Visual C or MinGW. The DLL likely is compiled with either MSVC (or the MinGW compiler toolchain which should use compatible definitions) so if the CVI type would not agree with what MSVC would normally use, you might get crashes.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 3
(2,801 Views)

Another possibility is to use SQLite. Much simpler and far smaller. Excellent tools for db management. 

0 Kudos
Message 3 of 3
(2,771 Views)