Error compiling a simple C program
Posted by: Joseph Earl
Date: December 09, 2012 11:50PM

OS: Windows XP service pack 3
MySQL Server v 5.5
C Compiler MINGW - Minimalist GNU for windows

I am trying to write a simple C program to access a mysql database as follows:
#include <my_global.h>
#include <mysql.h>

int main(int argc, char **argv)
printf("MySQL client version: %s\n", mysql_get_client_info());
I have copied the include files that came with mysql server 5.5 to the include directory on the MINGW compiler directory structure.

When I try to compile I get the following error:

In file included from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/io.h:20:0,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/my_global.h:127,
from loadpcode.c:6:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/sys/types.h:100:17: error: two or more data types in declaration specifiers
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/sys/types.h:110:19: error: two or more data types in declaration specifiers
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/sys/types.h:119:18: error: conflicting types for 'SSIZE_T'
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/winnt.h:192:0,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/windef.h:253,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/windows.h:48,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/winsock2.h:22,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/my_global.h:125,
from loadpcode.c:6:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/basetsd.h:111:18: note: previous declaration of 'SSIZE_T' was here
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/my_global.h:1039:0,
from loadpcode.c:6:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/../../../../include/my_dbug.h:108:20: fatal error: crtdbg.h: No such file or directory
compilation terminated.

Am I using the correct include files? I have also tried the include files from Connector C 6.0.2 but get similar errors?

What am I doing wrong?

Options: ReplyQuote

Written By
Error compiling a simple C program
December 09, 2012 11:50PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.