Hi,
please help me with error.
I want to run simple project below.
I have a lot of errors below and don't know how to fix it.

I use GCC port (Mingw)

#include "mysql/my_global.h"
#include "mysql/mysql.h"
#include <stdio.h>

int main(int argc, char **argv)
{
  printf("MySQL client version: %s\n", mysql_get_client_info());
}

error
----------Build Started--------
C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe" -j 2 -f "learn MySQL_wsp.mk""
----------Building project:[ basics - Debug ]----------
mingw32-make.exe[1]: Entering directory `C:/Documents and Settings/stefano/Desktop/C++/learn MySQL'
gcc -c "C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c" -g -DSTACK_DIRECTION=1 -o ./Debug/main.o "-I." "-I." "-I./mysql"
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:76,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
./mysql/config-win.h:203:1: warning: "finite" redefined
./mysql/config-win.h:161:1: warning: this is the location of the previous definition
./mysql/config-win.h:245:1: warning: "STACK_DIRECTION" redefined
<command-line>: warning: this is the location of the previous definition
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:415,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../include/stdio.h:491: error: expected declaration specifiers or '...' before '(' token
c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../include/stdio.h:491: error: expected declaration specifiers or '...' before '(' token
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:616:1: warning: "my_reinterpret_cast" redefined
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:76,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
./mysql/config-win.h:307:1: warning: this is the location of the previous definition
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:1566: error: static declaration of 'rint' follows non-static declaration
mingw32-make.exe[1]: *** [Debug/main.o] Error 1
mingw32-make.exe[1]: Leaving directory `C:/Documents and Settings/stefano/Desktop/C++/learn MySQL'
mingw32-make.exe: *** [All] Error 2
----------Build Ended----------
5 errors, 5 warnings

Edited 6 Years Ago by Stefano Mtangoo: n/a

Now I have resolved the stack direction thing I have this error:
Note that, the line 415 in my_global.h is simple ifdef include

#ifndef stdin
#include <stdio.h>
#endif

here is error
----------Build Started--------
C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe" -j 2 -f "learn MySQL_wsp.mk""
----------Building project:[ basics - Release ]----------
mingw32-make.exe[1]: Entering directory `C:/Documents and Settings/stefano/Desktop/C++/learn MySQL'
gcc -c "C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c" -DSTACK_DIRECTION=1 -o ./Release/main.o "-I." "-I." "-I./mysql"
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:76,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
./mysql/config-win.h:203:1: warning: "finite" redefined
./mysql/config-win.h:161:1: warning: this is the location of the previous definition
./mysql/config-win.h:245:1: warning: "STACK_DIRECTION" redefined
<command-line>: warning: this is the location of the previous definition
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:415,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../include/stdio.h:491: error: expected declaration specifiers or '...' before '(' token
c:\mingw-4.4.1\bin\../lib/gcc/mingw32/4.4.1/../../../../include/stdio.h:491: error: expected declaration specifiers or '...' before '(' token
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:616:1: warning: "my_reinterpret_cast" redefined
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:76,
from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
./mysql/config-win.h:307:1: warning: this is the location of the previous definition
In file included from C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/main.c:1:
C:/Documents and Settings/stefano/Desktop/C++/learn MySQL/mysql/my_global.h:1566: error: static declaration of 'rint' follows non-static declaration
mingw32-make.exe[1]: *** [Release/main.o] Error 1
mingw32-make.exe[1]: Leaving directory `C:/Documents and Settings/stefano/Desktop/C++/learn MySQL'
mingw32-make.exe: *** [All] Error 2
----------Build Ended----------
5 errors, 5 warnings

This post has had over a thousand views can someone pls post an answer...

Comments
It's also 1/2 a year old. The OP probably has it fixed by now. If YOU need help, start a new thread.

#include<mysql.h> requires GCC 4.5.0 or above, so first thing to do is upgrade compiler.

http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20110211/mingw-get-inst-20110211.exe/download

Some links in the pre-packed are broken, so check "Download latest repository catalogues" upon installation.

Warnings like "finite redefined" can be ignored.

Thanks, but now I work mainly with Linux and I use mysql_config and it works just fine!

This question has already been answered. Start a new discussion instead.