<?xml version="1.0" encoding="utf-8"?>
<launchpad-bug id="808233">
  <date_last_updated>2011-12-13 16:06:26.121712+00:00</date_last_updated>
  <api_links>
    <bug_api_link>https://api.launchpad.net/1.0/bugs/808233</bug_api_link>
    <bug_owner_link>https://api.launchpad.net/1.0/~padamsn</bug_owner_link>
    <milestone_link>https://api.launchpad.net/1.0/maria/+milestone/5.1</milestone_link>
    <linked_branches_collection_link>https://api.launchpad.net/1.0/bugs/808233/linked_branches</linked_branches_collection_link>
    <activity_link>https://api.launchpad.net/1.0/bugs/808233/activity</activity_link>
  </api_links>
  <bug_web_link>https://bugs.launchpad.net/bugs/808233</bug_web_link>
  <owner>eadthem akip</owner>
  <assignee>Vladislav Vaintroub</assignee>
  <milestone_title>Maria 5.1</milestone_title>
  <duplicate_link></duplicate_link>
  <duplicate_bug_id></duplicate_bug_id>
  <title>Default Int or undefined uint in typelib.h</title>
  <status>Fix Released</status>
  <importance>Medium</importance>
  <created>2011-07-10 06:37:22.611621+00:00</created>
  <description>
<![CDATA[When trying to build a client application against the mariaDB 5.2.4 or 5.2.7 library the compiler complains about undefined uint in the line.

my system info
windows XP pro 32bit
mariaDB 5.2.7 and 5.2.4 noinstall zip's tested and same results occur on both  visual c++ 2005 and visual c++2010
with 5.2.4 and 5.2.7

If this builds on nix or with a C compiler it because assumes its a int (default int)  then that could be another issue as well, as uint would say to me that its suppose to be a unsigned int.

The error occurs on the line 32 and 33 of typelib.h

extern uint find_type_or_exit(const char *x, TYPELIB *typelib,
                              const char *option);

The compiler error messages are

d:\mariadb\include\typelib.h(32) : error C2146: syntax error : missing ';' before identifier 'find_type_or_exit'
d:\mariadb\include\typelib.h(32) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\mariadb\include\typelib.h(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

the fix is

extern unsigned int find_type_or_exit(const char *x, TYPELIB *typelib,
                              const char *option);

eadthem]]>  </description>
  <activities>
    <activity datechanged="2011-07-10T06:37:22.611621+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[]]>      </newvalue>
      <whatchanged>bug</whatchanged>
      <person>eadthem akip</person>
      <message>added bug</message>
    </activity>
    <activity datechanged="2011-07-10T07:26:48.507485+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[Vladislav Vaintroub (wlad-montyprogram)]]>      </newvalue>
      <whatchanged>maria: assignee</whatchanged>
      <person>Philip Stoev</person>
      <message></message>
    </activity>
    <activity datechanged="2011-07-10T11:23:41.471650+00:00">
      <oldvalue>
<![CDATA[Undecided]]>      </oldvalue>
      <newvalue>
<![CDATA[Medium]]>      </newvalue>
      <whatchanged>maria: importance</whatchanged>
      <person>Vladislav Vaintroub</person>
      <message></message>
    </activity>
    <activity datechanged="2011-07-10T11:23:41.471650+00:00">
      <oldvalue>
<![CDATA[New]]>      </oldvalue>
      <newvalue>
<![CDATA[Fix Committed]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Vladislav Vaintroub</person>
      <message></message>
    </activity>
    <activity datechanged="2011-07-10T11:23:41.471650+00:00">
      <oldvalue>
<![CDATA[]]>      </oldvalue>
      <newvalue>
<![CDATA[5.1]]>      </newvalue>
      <whatchanged>maria: milestone</whatchanged>
      <person>Vladislav Vaintroub</person>
      <message></message>
    </activity>
    <activity datechanged="2011-12-13T16:06:25.560733+00:00">
      <oldvalue>
<![CDATA[Fix Committed]]>      </oldvalue>
      <newvalue>
<![CDATA[Fix Released]]>      </newvalue>
      <whatchanged>maria: status</whatchanged>
      <person>Daniel Bartholomew</person>
      <message></message>
    </activity>
  </activities>
  <comments>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/808233/comments/1" datecreated="2011-07-10T11:23:41.471650+00:00">
      <person>Vladislav Vaintroub</person>
      <subject>
<![CDATA[Re: Default Int or undefined uint in typelib.h]]>      </subject>
      <content>
<![CDATA[I fixed it in 5.1 upwards. The workaround is to include my_global. h

"If this builds on nix or with a C compiler it because assumes its a int (default int) then that could be another issue as well, as uint would say to me that its suppose to be a unsigned int."

Would not build with C compiler either, unless uint is defined (C4430 is followup error, the real one is C2146)
On Unixes, uint is often be typedefed in system headers, thus it builds.

]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/808233/comments/2" datecreated="2011-07-10T14:16:07.650052+00:00">
      <person>eadthem akip</person>
      <subject>
<![CDATA[Re: Default Int or undefined uint in typelib.h]]>      </subject>
      <content>
<![CDATA[I tested the fix by adding #include "my_global.h" to the orignal files of both 5.2.4 and 5.2.7  and i receved the error messages.

d:\mariadb\include\my_global.h(605) : fatal error C1083: Cannot open include file: 'my_valgrind.h': No such file or directory

i was not able to find my_valgrind.h in any of the  noinstall zips for windows.

i also had to change my inclusion of winsock.h to winsock2.h in my applcation  as winsock.h was causing redefinition issues once my_global.h was included.


I pulled my_valgrind.h out of the source tarball for 5.2.4 , placed it in the /include/ folder and received the following error messages.

------------------------------------------------------------------------
d:\mariadb\include\my_compiler.h(104) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(105) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(106) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(107) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(108) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(109) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(126) : error C2894: templates cannot be declared to have 'C' linkage
d:\program files\microsoft visual studio 8\vc\include\new(53) : error C2732: linkage specification contradicts earlier specification for 'operator delete'
        d:\program files\microsoft visual studio 8\vc\include\new(53) : see declaration of 'operator delete'
d:\program files\microsoft visual studio 8\vc\include\new(54) : error C2732: linkage specification contradicts earlier specification for 'operator new'
        d:\program files\microsoft visual studio 8\vc\include\new(54) : see declaration of 'operator new'
d:\program files\microsoft visual studio 8\vc\include\new(80) : error C2732: linkage specification contradicts earlier specification for 'operator delete[]'
        d:\program files\microsoft visual studio 8\vc\include\new(80) : see declaration of 'operator delete[]'
d:\program files\microsoft visual studio 8\vc\include\new(83) : error C2732: linkage specification contradicts earlier specification for 'operator new[]'
        d:\program files\microsoft visual studio 8\vc\include\new(82) : see declaration of 'operator new[]'
d:\program files\microsoft visual studio 8\vc\include\new(88) : error C2733: second C linkage of overloaded function 'operator new' not allowed
        d:\program files\microsoft visual studio 8\vc\include\new(87) : see declaration of 'operator new'
d:\program files\microsoft visual studio 8\vc\include\new(91) : error C2733: second C linkage of overloaded function 'operator new[]' not allowed
        d:\program files\microsoft visual studio 8\vc\include\new(90) : see declaration of 'operator new[]'
d:\program files\microsoft visual studio 8\vc\include\new(94) : error C2733: second C linkage of overloaded function 'operator delete' not allowed
        d:\program files\microsoft visual studio 8\vc\include\new(93) : see declaration of 'operator delete'
d:\program files\microsoft visual studio 8\vc\include\new(97) : error C2733: second C linkage of overloaded function 'operator delete[]' not allowed
        d:\program files\microsoft visual studio 8\vc\include\new(96) : see declaration of 'operator delete[]'
------------------------------------------------------------------------

and the same action for 5.2.7 yealds.

------------------------------------------------------------------------
d:\mariadb\include\my_compiler.h(109) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(110) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(111) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(112) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(113) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(114) : error C2894: templates cannot be declared to have 'C' linkage
d:\mariadb\include\my_compiler.h(131) : error C2894: templates cannot be declared to have 'C' linkage
d:\program files\microsoft visual studio 8\vc\include\new(53) : error C2732: linkage specification contradicts earlier specification for 'operator delete'
        d:\program files\microsoft visual studio 8\vc\include\new(53) : see declaration of 'operator delete'
d:\program files\microsoft visual studio 8\vc\include\new(54) : error C2732: linkage specification contradicts earlier specification for 'operator new'
        d:\program files\microsoft visual studio 8\vc\include\new(54) : see declaration of 'operator new'
d:\program files\microsoft visual studio 8\vc\include\new(80) : error C2732: linkage specification contradicts earlier specification for 'operator delete[]'
        d:\program files\microsoft visual studio 8\vc\include\new(80) : see declaration of 'operator delete[]'
d:\program files\microsoft visual studio 8\vc\include\new(83) : error C2732: linkage specification contradicts earlier specification for 'operator new[]'
        d:\program files\microsoft visual studio 8\vc\include\new(82) : see declaration of 'operator new[]'
d:\program files\microsoft visual studio 8\vc\include\new(88) : error C2733: second C linkage of overloaded function 'operator new' not allowed
        d:\program files\microsoft visual studio 8\vc\include\new(87) : see declaration of 'operator new'
d:\program files\microsoft visual studio 8\vc\include\new(91) : error C2733: second C linkage of overloaded function 'operator new[]' not allowed
        d:\program files\microsoft visual studio 8\vc\include\new(90) : see declaration of 'operator new[]'
d:\program files\microsoft visual studio 8\vc\include\new(94) : error C2733: second C linkage of overloaded function 'operator delete' not allowed
        d:\program files\microsoft visual studio 8\vc\include\new(93) : see declaration of 'operator delete'
d:\program files\microsoft visual studio 8\vc\include\new(97) : error C2733: second C linkage of overloaded function 'operator delete[]' not allowed
        d:\program files\microsoft visual studio 8\vc\include\new(96) : see declaration of 'operator delete[]'
------------------------------------------------------------------------


thanks  eadthem]]>      </content>
    </comment>
    <comment commentlink="https://api.launchpad.net/1.0/maria/+bug/808233/comments/3" datecreated="2011-07-10T14:51:58.602076+00:00">
      <person>Vladislav Vaintroub</person>
      <subject>
<![CDATA[Re: Default Int or undefined uint in typelib.h]]>      </subject>
      <content>
<![CDATA[my_global.h worked at some point of time, and it is still in the official MySQL documentation, so I assumed it would still work ok.
Sorry it did not work anymore. I'd suggest to go the #include <mysql.h> root and manually change uint to unsigned in the affected header,because this was the real fix pushed into 5.1,5.2 and 5.3

The rest of the errors are mostly likely due to extern "C" somewhere in your code, prior to inclusion of my_global.h . It does not play well inside my_compiler.h , in #ifdef __cplusplus block.

]]>      </content>
    </comment>
  </comments>
</launchpad-bug>
