Bug #73353 min() and max() test() macros defines in my_global.h conflict with c++ headers
Submitted: 22 Jul 2014 2:16 Modified: 22 Aug 2014 19:20
Reporter: Dustin Sandage Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / C++ Severity:S3 (Non-critical)
Version:5.5.38 OS:Any
Assigned to: CPU Architecture:Any

[22 Jul 2014 2:16] Dustin Sandage
Description:
This is very similar to Bug #28184.  That bug was resolved back in 2007 and as far as I can tell 5.5.38 is current as of 2014-05-30.

How to repeat:
Try to build with the following includes (I am using gcc/g++ 4.8 on Ubuntu 14.04 with MySQL 5.5)

#include <my_global.h>
#include <mysql.h>
#include <mysql_connection.h>

int main(){ 

   
} 

Suggested fix:
Change names of macros from min to mysql_min and max to mysql_max.
[22 Jul 2014 2:25] Dustin Sandage
Forgot to include test(), an apparent difference from the 2007 bug.
[22 Jul 2014 2:31] Dustin Sandage
in my_global.h it suggests that min and max should be defined "after all headers" but I cannot find a way to adjust the order in which I include my_global.h that accommodates this and also permits proper compilation.  If I remove all code I can put my_global.h at the end and works fine, but add any mysql connector code and you get a lot of "undefined reference to ..." errors.
[22 Jul 2014 2:50] Dustin Sandage
I can use undef on min and max and apparently move on with life, but if I undef test I start getting a string of "undefined reference to 'mysql_xxxx' messages.
[22 Jul 2014 19:20] Sveta Smirnova
Thank you for the report.

You are compiling with c/C++, but refer to my_global.h Please explain why and provide g++ command you use to compile the test.
[23 Aug 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".