A small bug in C ++ sstream (not a bug)

Source: Internet
Author: User

I wrote a program and tried to use the MySQL database to access the remote database. Sstream: # include <sstream> is used in the code.

 

A strange error occurs. For the statement "# include <sstream>", the compiler reports an error:

.....

Bits/sstream. TCC: 112: Error: Expected unqualified-ID before ....

.....

 

I tried every means I could not find any bugs. I had the idea of modifying STL source code.

Finally, Google is useful. It seems that MySQL has defined Max and Min macros, which are used in sstream.

The solution is to put all the other # include files in front and add "# include <sstream> ", add "# UNDEF Max" "# UNDEF min" before this sentence ":

 

....

# Include <...>

.....

 

# UNDEF Max

# UNDEF min

# Include <sstream>

 

Done.

 

Save the photo.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.