Default Int or undefined uint in typelib.h

Bug #808233 reported by eadthem akip
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
Medium
Vladislav Vaintroub

Bug Description

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

Changed in maria:
assignee: nobody → Vladislav Vaintroub (wlad-montyprogram)
Revision history for this message
Vladislav Vaintroub (wlad-montyprogram) wrote :

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.

Changed in maria:
importance: Undecided → Medium
milestone: none → 5.1
status: New → Fix Committed
Revision history for this message
eadthem akip (padamsn) wrote :
Download full text (6.4 KiB)

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...

Read more...

Revision history for this message
Vladislav Vaintroub (wlad-montyprogram) wrote :

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.

Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.