Trouble with C header file to compile Windows application
Posted by: mikha
Date: February 24, 2005 03:05PM

I start to use Windows-targeted variant GCC (http://gcc.gnu.org/) - MinGW (http://www.mingw.org/) to make application with using MySQL client in C environment.
So http://dev.mysql.com/doc/mysql/en/c-api-functions.html is main guide.
Before under FreeBSD I have no problem with linking MySQL library standard way:
gcc -L/usr/local/lib/mysql -lmysqlclient -lz -lcrypt -lm -L/usr/lib -lssl -lcrypto -o application application.c

#include "/usr/local/include/mysql/mysql.h"
MYSQL ConnectionHandle; MYSQL_RES *Resource; MYSQL_ROW Row;
int main (int argc, char **argv) {
mysql_real_connect (&ConnectionHandle, ...

All is OK.

But this time, in Windows environment:
#include "C:\Program Files\MySQL\MySQL Server 4.1\include\mysql.h"

C:\MinGW\bin\gcc.exe -mconsole -I"C:\Program Files\MySQL\MySQL Server 4.1\include" -L"C:\Program Files\MySQL\MySQL Server 4.1\lib\opt" -lmysqlclient -lm -o application.exe application.c

produces huge number "C:/MinGW/include/mysql.h:687: parse error before '*' token"

In fact it's missed way to get compile C-sourced application with MySQL client library.
Headers, library and other binaries is for Windows platform, of course.
So, how to fix it?

Options: ReplyQuote


Subject
Written By
Posted
Trouble with C header file to compile Windows application
February 24, 2005 03:05PM


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.