Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9140 closed Bugs (fixed)

Building boost::log's snprintf.hpp in Sun Studio 12.3: some functions aren't defined that are expected

Reported by: Brian Vandenberg <phantall+boost@…> Owned by: Andrey Semashev
Milestone: To Be Determined Component: log
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc: phantall+boost@…

Description

I get the following error building with Sun Studio 12.3:

"./boost/log/detail/snprintf.hpp", line 40: snprintf is not defined.
"./boost/log/detail/snprintf.hpp", line 41: vsnprintf is not defined.
"./boost/log/detail/snprintf.hpp", line 44: swprintf is not defined.
"./boost/log/detail/snprintf.hpp", line 45: vswprintf is not defined.

Changes needed are something along the lines of:

#if defined( __SUNPRO_CC )
#include <stdio.h>
#else
#include <cstdio>
#endif

... and

#if defined( __SUNPRO_CC )
using std::swprintf;
using std::vswprintf;
#else
using ::swprintf;
using ::vswprintf;
#endif

Change History (7)

comment:1 by Andrey Semashev, 9 years ago

The compiler has non-compliant standard headers. This issue can be worked around by Boost.Compatibility.

comment:2 by Andrey Semashev, 9 years ago

Resolution: fixed
Status: newclosed

Should be fixed in [85810].

comment:3 by Brian Vandenberg <phantall+boost@…>, 9 years ago

I just tried the suggested fix and I'm still seeing errors indicating that snprintf / vsnprintf are not defined.

comment:4 by Brian Vandenberg <phantall+boost@…>, 9 years ago

ack. my apologies, I'm experimenting with getting boost::asio to build and have -D_XOPEN_SOURCE=1 in my command-line args ... there's some odd stuff going on with that.

comment:5 by Brian Vandenberg <phantall+boost@…>, 9 years ago

Cc: phantall+boost@… added

comment:6 by Andrey Semashev, 9 years ago

So, is the problem fixed eventually?

comment:7 by Brian Vandenberg <phantall+boost@…>, 9 years ago

I should've made that more clear. Yes, I applied the changes you made and the problem gets resolved.

Note: See TracTickets for help on using tickets.