When I #include <fstream> with mingw64-g++ the PRId64 value is no longer 
interpreted correctly.

Here is the test program:

#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <fstream>
int main(int argc,char **argv)
{
    uint64_t val=1234567890;
    printf("%"PRId64"\n",val);
    exit(0);
}


[simsong@FC17 ~]$ x86_64-w64-mingw32-g++ -Wall x.cpp
x.cpp: In function 'int main(int, char**)':
x.cpp:19:29: warning: unknown conversion type character 'l' in format [-Wformat]
x.cpp:19:29: warning: too many arguments for format [-Wformat-extra-args]
[simsong@FC17 ~]$ 

But if I change the test program to this:

#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
//#include <fstream>
int main(int argc,char **argv)
{
    uint64_t val=1234567890;
    printf("%"PRId64"\n",val);
    exit(0);
}

Then I have no problem compiling:

[simsong@FC17 ~]$ x86_64-w64-mingw32-g++ -Wall x.cpp
[simsong@FC17 ~]$ 


[simsong@FC17 ~]$ x86_64-w64-mingw32-g++ --version
x86_64-w64-mingw32-g++ (GCC) 4.7.0 20120322 (Fedora MinGW 4.7.0-2.fc17)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[simsong@FC17 ~]$ 

This makes no sense to me. Is this a bug?


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to