How macro redefinition errors are resolved using the Boost library in VS

Source: Internet
Author: User
Tags define definition config modify visual studio

The recent use of boost library for multithreaded development, visual in VS compiler engineers always encounter macro redefinition error, similar to the following error description

1>c:\program files (x86) \microsoft Visual Studio 10.0\vc\include\stdint.h (116): Warning C4005: ' int8_c ': Macro Redefi Nition

1> c:\vc\include\boost\cstdint.hpp (376): Previous definition of ' int8_c '

At first no tube, visible later this thing is really slow to compile speed, so can not endure, decisive Google, found that boost official has been submitted to the bug and the state is already repaired, refer to the link below

Ticket #4182

The following reply says that it is necessary to define "Boost_has_stdint_h" in config file to solve the problem, but I experimented for half a day without any effect, and then look at the repair changeset 62082, found that the modified is the following file

Boost/config/compiler/visualc.hpp

Then I checked the file I used and found it was fixed, but why was it wrong, so I tried to comment out

# define Boost_has_stdint_h

And then recompile, and found that the problem was solved,

So the Final solution is:

Modify VC compiler configuration File "Boost/config/compiler/visualc.hpp", comment out "BOOST_HAS_STDINT_H" macro definition, can solve the problem

#if _msc_ver >= 1600
//#  define Boost_has_stdint_h
#endif

Or you can just comment out these lines completely.

This modification of the principle of speculation: it should be Microsoft's VC compiler related files also handled the problem, resulting in both sides to modify the macro definition, resulting in the equivalent of the macro definition is still not modified, the file contains duplicate.

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/cplus/

Author: cnblogs Angry Frog

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.