Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6251 closed Bugs (fixed)

mingw gcc-4.5.0 compiler error: Undeclared swprintf

Reported by: viboes Owned by: Antony Polukhin
Milestone: To Be Determined Component: lexical_cast
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description

gcc.compile.c++ ..\..\..\bin.v2\libs\test\build\gcc-mingw-4.5.0x\debug\link-static\threading-multi\exception_safety.o
In file included from ..\..\../boost/test/interaction/interaction_based.hpp:27:0,
                 from ..\..\../boost/test/impl/exception_safety.ipp:29,
                 from ..\..\..\libs\test\src\exception_safety.cpp:16:
..\..\../boost/lexical_cast.hpp: In member function 'bool boost::detail::lexical_stream_limited_src<CharT, Traits, RequiresStringbuffer>::shl_float(float, wchar_t*)':
..\..\../boost/lexical_cast.hpp:1248:120: error: there are no arguments to 'swprintf' that depend on a template parameter, so a declaration of 'swprintf' must be available
..\..\../boost/lexical_cast.hpp:1248:120: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
..\..\../boost/lexical_cast.hpp: In member function 'bool boost::detail::lexical_stream_limited_src<CharT, Traits, RequiresStringbuffer>::shl_double(double, wchar_t*)':
..\..\../boost/lexical_cast.hpp:1269:122: error: there are no arguments to 'swprintf' that depend on a template parameter, so a declaration of 'swprintf' must be available

    "c:/MINGW/bin/g++"  -ftemplate-depth-128 -std=c++0x -O0 -fno-inline -Wall -pedantic -g -mthreads  -DBOOST_ALL_NO_LIB=1  -I"..\..\.." -c -o "..\..\..\bin.v2\libs\test\build\gcc-mingw-4.5.0x\debug\link-static\threading-multi\exception_safety.o" "..\..\..\libs\test\src\exception_safety.cpp"

Change History (3)

comment:1 by Antony Polukhin, 11 years ago

Owner: changed from nasonov to Antony Polukhin
Status: newassigned
Version: Boost 1.48.0Boost 1.49.0

This looks like a mingw bug. It has been reported and looks like it is fixed (at least it is not reproduced at mingw-4.5.2_0x).

Workaround was proposed:

#if (defined(__MINGW32__) || defined(__MINGW64__)) && (__GNUC__ == 4) 
// workaround a mingw bug, http://sourceforge.net/tracker/index.php?func=detail&aid=2373234&group_id=2435&atid=102435
int swprintf (wchar_t *, size_t, const wchar_t *, ...);
#endif

(must be added to lexical_cast.hpp after #includes ao before the inclusion of lexical_cast.hpp)

I`ll test it on mingw by myself and then apply to trunk.

comment:2 by Antony Polukhin, 11 years ago

Resolution: fixed
Status: assignedclosed

(In [76599]) Attempt to fix #6251

comment:3 by Antony Polukhin, 11 years ago

(In [76887]) Merge from trunk (fixed #6251, fixed #6453, disabled some optimizations for sunCC #6462)

Note: See TracTickets for help on using tickets.