Use of %ll in PropertyHelper.h doesn't play well with mingw

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

gamecat
Just popping in
Just popping in
Posts: 20
Joined: Mon Jan 12, 2009 06:40
Location: SF Bay Area

Use of %ll in PropertyHelper.h doesn't play well with mingw

Postby gamecat » Tue Oct 15, 2013 04:40

I'm gettting

.../PropertyHelper.h:329:42: warning: unknown conversion type character 'l' in format [-Wformat]
.../PropertyHelper.h:329:42: warning: too many arguments for format [-Wformat-extra-args]

warnings when compiling my program using mingw with gcc 4.7.2.

This gets into the whole lame mingw MSVCRT .vs. C99 compliance issue. On my system, the program compiles and
runs ok despite the warning, but I'm worried about compatibility with other systems.

From http://stackoverflow.com/questions/10763854/printf-and-llx-in-gcc-under-windows-64x

the issue is that formatter-width specifier %ll isn't supported for all msvcrt-DLL versions, therefore gcc warns about its use. The
variant for specifying 64-bit integer-scalar-width in formatter for msvcrt in a backward-compatible way is by using %I64.


I've tried using the __USE_MINGW_ANSI_STDIO macro, but it doesn't seem to help.

As far as I can tell, PropertyHelper.h is the only CEGUI file that uses %ll. Would it be possible to get some conditional thrown in?

Code: Select all

#ifdef __MINGW32__
#include <inttypes.h>
#endif

static return_type fromString(const String& str)
   {
      uint64 val = 0;
#ifdef __MINGW32__
      sscanf(str.c_str(), " %"PRIu64"", &val);
#else
      sscanf(str.c_str(), " %llu", &val);
#endif
      return val;
   }


Have any of you other mingw people out there encountered this problem? If so, then how did you deal with it?

I'm tempted to try out MinGW-w64 since it has better C99 support and 64bit capability, among other things. Has anyone out there tried building CEGUI / Ogre3D / Boost with MinGW-w64? Is it more or less drop in compatible, or will I be opening another can of worms?

Return to “Help”

Who is online

Users browsing this forum: No registered users and 1 guest