Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#5791 closed Bugs (wontfix)

(MinGW) fail to compile asio when c++0x enabled

Reported by: Jamboree <tongari95@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:


After including <boost/asio.hpp> I got the error:

boost_1_47_0/boost/asio/detail/impl/win_static_mutex.ipp:51:63: error: 'swprintf' was not declared in this scope

Without -std=c++0x, it compiles fine, I use g++4.5.2/MinGW on XP SP3.
This causal file seems to be shipped with the new signal_set feature.

Change History (4)

comment:1 Changed 7 years ago by MKP

Use -std=gnu++0x flag instead of -std=c++0x and it should work.

comment:2 in reply to:  1 Changed 7 years ago by Jamboree <tongari95@…>

Replying to MKP:

Use -std=gnu++0x flag instead of -std=c++0x and it should work.

Indeed. Thanks for the tip.

comment:3 Changed 6 years ago by chris_kohlhoff

Resolution: wontfix
Status: newclosed

I have no plans to change any code for this as it appears to be a MinGW bug, and -std=gnu++0x may be used as a workaround.

comment:4 Changed 6 years ago by…

Since this page comes up on google for people that have this problem there is a better way to solve it other then using -std=gnu++0x. Continue using -std=c++11 or -std=c++0x but add -USTRICT_ANSI since the problem is that -std=c++11 defines the strict ansi stuff, and the workaround -std=gnu++0x does not define it. So we solve it by simply undefining it.

Note: See TracTickets for help on using tickets.