Bug #52959 uint in typedef.h undefined on Windows
Submitted: 20 Apr 2010 2:28 Modified: 4 Aug 2010 16:41
Reporter: Anders Karlsson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:5.5.3-m3 OS:Windows (XP)
Assigned to: Vladislav Vaintroub CPU Architecture:Any
Tags: typedef, typelib, uint

[20 Apr 2010 2:28] Anders Karlsson
Description:
Compiling a simple helloworld C-program on Windows including mysql.h fails. I use VS2003, but this work when compiled against the 5.1s I have tried, but fails when using 5.5.3-m3. The program looks like this:

#include <stdio.h>
#include <windows.h>
#include <mysql.h>

int main(int argc, char *argv[])
	{
	printf("Hello, MySQL\n");

	return 0;
	}

And the errors I get are:
d:\MySQL553\include\typelib.h(38) : error C2146: syntax error : missing ')' before identifier 'default_name'
d:\MySQL553\include\typelib.h(38) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>'
d:\MySQL553\include\typelib.h(38) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>'
d:\MySQL553\include\typelib.h(38) : error C2143: syntax error : missing ')' before 'identifier'
d:\MySQL553\include\typelib.h(38) : error C2081: 'uint' : name in formal parameter list illegal
d:\MySQL553\include\typelib.h(38) : error C2061: syntax error : identifier 'default_name'
d:\MySQL553\include\typelib.h(38) : error C2059: syntax error : ';'
d:\MySQL553\include\typelib.h(38) : error C2059: syntax error : ','
d:\MySQL553\include\typelib.h(41) : error C2059: syntax error : ')'

All this boils down to the type uint not being defined, which is used in typelib.h in the definition of "find_set_from_flags" which seems to be new in 5.5.

How to repeat:
Compile the simple program mentioned above against mySQL 5.5-m3

Suggested fix:
Either make sure that uint is defined when including mysql.h in client programs, or, rather, make sure that it isn't used in such circumstances (and this seems to be the only case with this issue).
[22 Apr 2010 17:13] MySQL Verification Team
Thank you for the bug report.

1>------ Build started: Project: bug52959, Configuration: Release Win32 ------
1>Compiling...
1>bug52959.cpp
1>c:\build\5.5-mr-20100420\include\typelib.h(39) : error C2061: syntax error : identifier 'uint'
1>Build log was saved at "file://c:\build\5.5-mr-20100420\bug52959\Release\BuildLog.htm"
1>bug52959 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

WORK-AROUND:

#define __WIN__
#include <my_global.h>
#include <mysql.h>

int main(int argc, char *argv[])
	{
	printf("Hello, MySQL\n");

	return 0;
	}

1>------ Build started: Project: bug52959, Configuration: Release Win32 ------
1>Compiling...
1>bug52959.cpp
1>Linking...
1>Generating code
1>Finished generating code
1>Embedding manifest...
1>Build log was saved at "file://c:\build\5.5-mr-20100420\bug52959\Release\BuildLog.htm"
1>bug52959 - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
[27 Apr 2010 5:14] Daniel Fischer
Note that we require at least VS2008 for 5.5 (possibly VS2010). Does the problem occur with VS2008?
[16 Jun 2010 21:20] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/111331

3245 Vladislav Vaintroub	2010-06-16
      Bug #52959 uint in typedef.h undefined on Windows
      Fix: change uint to "unsigned int"
[16 Jun 2010 21:21] Vladislav Vaintroub
queued to next-mr-bugfixing
[22 Jun 2010 13:11] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100622130623-r7yhm89fz9n5t9nb) (version source revid:marko.makela@oracle.com-20100603095032-v5ptkkzt1bhz0m1d) (pib:16)
[5 Jul 2010 16:27] Vladislav Vaintroub
pushed to trunk-bugfixing
[18 Jul 2010 18:59] Robert Gebis
I am on 5.5.5-m3 and it still a problem. Using VS2008. Any specific time when it will be available in main source package.
[23 Jul 2010 12:23] Bugs System
Pushed into mysql-trunk 5.5.6-m3 (revid:alik@sun.com-20100723121820-jryu2fuw3pc53q9w) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[23 Jul 2010 12:30] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100723121929-90e9zemk3jkr2ocy) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (pib:18)
[27 Jul 2010 0:54] Paul DuBois
Noted in 5.5.6 changelog.

Use of uint in typelib.h caused compilation problems in Windows. This
was changed to unsigned int.
[4 Aug 2010 8:03] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:marko.makela@oracle.com-20100603095032-v5ptkkzt1bhz0m1d) (merge vers: 5.1.48) (pib:18)
[4 Aug 2010 8:19] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:marko.makela@oracle.com-20100603095032-v5ptkkzt1bhz0m1d) (merge vers: 5.1.48) (pib:18)
[4 Aug 2010 16:41] Paul DuBois
Not present in any released 5.6.x version.