gina-alaska / dans-gdal-scripts

A number of utilities for use in conjunction with GDAL.
http://www.gina.alaska.edu/projects/gina-tools/
Other
158 stars 42 forks source link

Unknown conversion type character 'z' in format #3

Closed snorfalorpagus closed 10 years ago

snorfalorpagus commented 10 years ago

When compiling on Windows 7 (using mingw32) I get several warnings like this:

gdal_landsat_pansharp.cc:205:65: warning: unknown conversion type character 'z' in format

Once compiled the programs function normally, except where there should be numbers in the output strings, eg:

Output size is zd x zd x zd
dstahlke commented 10 years ago

Joshua,

Type this: CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1" and then do "./configure" and "make". Let me know if that works.

I have not been able to reproduce this on my machine since I've been unable to install GDAL under MinGW. Is there an easy way? The instructions on the GDAL page are quite lengthy.

On 11/15/2013 05:08 AM, Joshua Arnott wrote:

When compiling on Windows 7 (using mingw32) I get several warnings like this:

gdal_landsat_pansharp.cc:205:65: warning: unknown conversion type character 'z' in format

Once compiled the programs function normally, except where there should be numbers in the output strings, eg:

Output size is zd x zd x zd

— Reply to this email directly or view it on GitHub https://github.com/gina-alaska/dans-gdal-scripts/issues/3.

snorfalorpagus commented 10 years ago

Dan,

I didn't need to do anything special to build GDAL, other than using pre-compiled binaries for the Boost library. http://stackoverflow.com/questions/9598416/boost-binaries-for-mingw/9599214#9599214

Using -D__USE_MINGW_ANSI_STDIO=1 doesn't seem to have any effect, even though it looks to be the right thing to do. http://article.gmane.org/gmane.comp.gnu.mingw.user/27539/

dstahlke commented 10 years ago

From a small test program (I still haven't compiled GDAL), it seems that with |-D__USE_MINGW_ANSI_STDIO=1 the warnings persist but the program works properly. You can add the "-Wno-format|" flag to silence the warnings if you wish.

Also, from what I read online (haven't tried it), MinGW-w64 fixes the whole issue. If using the 64-bit compiler is an option then I would highly recommend it. Large files (over 2GB) will not work properly with the 32-bit version.

Let me know if these comments still do not solve the problem.

On 11/19/2013 04:35 AM, Joshua Arnott wrote:

Dan,

I didn't need to do anything special to build GDAL, other than using pre-compiled binaries for the Boost library. http://stackoverflow.com/questions/9598416/boost-binaries-for-mingw/9599214#9599214

Using |-D__USE_MINGW_ANSI_STDIO=1| doesn't seem to have any effect, even though it looks to be the right thing to do. http://article.gmane.org/gmane.comp.gnu.mingw.user/27539/

— Reply to this email directly or view it on GitHub https://github.com/gina-alaska/dans-gdal-scripts/issues/3#issuecomment-28776464.

snorfalorpagus commented 10 years ago

I had assumed the flag would prevent the warnings. You are correct - the program works correctly despite the warnings persisting.

dstahlke commented 10 years ago

Yeah, one would think. I discovered this only through experimentation.

Regardless of whether it works now, I still recommend MinGW-w64 if you will be using files over 1GB in size. Unfortunately this would require also recompiling GDAL and everything else connected to it as 64 bit.

On 11/20/2013 04:44 AM, Joshua Arnott wrote:

Dan,

I had assumed the flag would prevent the warnings. You are correct - the program works correctly despite the warnings persisting.

— Reply to this email directly or view it on GitHub https://github.com/gina-alaska/dans-gdal-scripts/issues/3#issuecomment-28874433.