JonY wrote:
> There is no such macro as __MINGW64__, use __MINGW64_VERSION_MAJOR
> instead, its guaranteed to be defined if you include any mingw-w64
> headers.
> 
> I think __USE_MINGW_ANSI_STDIO only applies to the printf family, the
> scanf family has not been ported yet, so you'll need to use %I64u
> instead of %llu.
> 

Hello, thank you all for your replies.  I seem to be having some trouble 
getting 
__MINGW64_VERSION_MAJOR to work for me.  Perhaps I have set up my environment 
wrong?  I've downloaded mingw-w64-bin_x86_64-mingw_20100123_sezero.zip and 
extracted it to its own folder, at c:\mingw64-20100123\ (which has bin, lib, 
lib64, etc in it).  Then I have created a command prompt, that when I start it, 
it sets the PATH to: PATH C:\mingw64-20100123\bin;C:\msys\1.0\bin;%PATH%
Does this look reasonable so for?

I was wondering, how does it know where the correct *.h or *.a files are?  I 
see 
that most of them are not in \include or \lib, but are under 
\x86_64-w64-mingw32\include and \x86_64-w64-mingw32\lib.  Does the gcc.exe in 
\bin know where to look for these files.  For example, I've created a test 
program that includes <stdio.h> and <inttypes.h>.  I've tried putting:
#ifdef __MINGW64_VERSION_MAJOR
#define __USE_MINGW_ANSI_STDIO 1
#endif
before those 2 includes, but it doesn't seem to work.  If I leave off the 
ifdef, 
it does work.  Can anyone see what I might be doing wrong?



Also, on another matter, when I just #define __USE_MINGW_ANSI_STDIO 1 it seems 
to break %"PRIu64" for sscanf.  I'm including my small test code so you can see 
what I am doing.

/* without this define, the sscanf with PRIu64 works fine */
#define __USE_MINGW_ANSI_STDIO 1

#include <stdio.h>
#include <inttypes.h>

typedef unsigned long long u64_t;

int main(int argc, char* argv[])
{
   u64_t a = 98765432101ULL;
   u64_t a_in;
   char a_str[] = "98765432101";
   char b_str[20];

   printf("Testing printf functions...\n");
   printf("str: a = %s\n", a_str);
   printf("llu: a = %llu\n", a);
   printf("pri: a = %"PRIu64"\n", a);
   printf("i64: a = %I64u\n", a);

   printf("\n");
   printf("Testing scanf functions...\n");

   sscanf(a_str, "%s", b_str);
   printf("str: a = %s\n", b_str);

   sscanf(a_str, "%llu", &a_in);
   printf("llu: a = %llu\n", a_in);

   sscanf(a_str, "%"PRIu64"", &a_in);
   printf("pri: a = %"PRIu64"\n", a_in);

   sscanf(a_str, "%I64u", &a_in);
   printf("i64: a = %I64u\n", a_in);

   return 0;
}

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to