Re: [Mingw-w64-public] Question on scanf and modifiers...
On Mon, Feb 1, 2010 at 4:59 AM, David Cleaver wrote: > > 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. >> To clarify things: __MINGW32__ and __MINGW64__ : They are both compiler 's built-in macros. __MINGW32__ is valid for both mingw.org and mingw-w64, for both x86 *and* for x64. __MINGW64__ is *only* valid for x64, therefore effectively for mingw-w64, because mingw.org doesn't support x64 (at least not yet.) __MINGW64_VERSION_MAJOR, on the other hand, is *not* a compiler built-in macro. It is a macro defined by the mingw-w64 headers, specifically through _mingw.h. Most, if not all, of the headers already include _mingw.h, so if you want to check for .__MINGW64_VERSION_MAJOR you must do it *after* including some standart headers such as stdio.h or stdlib.h or even windows.h >> 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? > Yes. > 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 Yes. > program that includes and . 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? > Please do the check *after* the includes. If you truly want to define the things for mingw-w64 *and* before including further headers yet, try something like this at the top of your source: #ifdef __MINGW32__ #include <_mingw.h> #endif #ifdef __MINGW64_VERSION_MAJOR [your stuff here] #endif #include [your actual includes here] Hope these help. -- Ozkan -- 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
Re: [Mingw-w64-public] Question on scanf and modifiers...
On Sun, Jan 31, 2010 at 9:59 PM, David Cleaver wrote: > 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? Perfect start. > 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. It typically finds failes relative to itself, along with several hard coded directories. You can use the option "-print-search-dirs" or something similar (I forget exactly what it is offhand) to gcc to see where it looks. You can also use gcc -v to see all the options it passes to ld. -- 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
Re: [Mingw-w64-public] Question on scanf and modifiers...
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 and . 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
#include
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
Re: [Mingw-w64-public] Question on scanf and modifiers...
> I know it wasn't long ago that I was asking about using %llu in fscanf or > sscanf. However, I am wondering if anything has changed in this regard? Does > MingW64 support %llu in the scanf functions? Use SCNu64 from . That's what it's for. --tml -- 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
Re: [Mingw-w64-public] Question on scanf and modifiers...
On Fri, Jan 29, 2010 at 11:11 PM, David Cleaver wrote: > Hello again, > > I know it wasn't long ago that I was asking about using %llu in fscanf or > sscanf. However, I am wondering if anything has changed in this regard? Does > MingW64 support %llu in the scanf functions? > > Also, in the future, is there an easy way for me to find out this information > on > my own? Perhaps if someone could point out which file something like this was > defined in, I could look at the latest version of the file to see if the > change > is in there? Best bet is to file a feature request, and we'll keep updates there. -- 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
Re: [Mingw-w64-public] Question on scanf and modifiers...
On 1/30/2010 12:11, David Cleaver wrote: > Hello again, > > I know it wasn't long ago that I was asking about using %llu in fscanf or > sscanf. However, I am wondering if anything has changed in this regard? Does > MingW64 support %llu in the scanf functions? > > Also, in the future, is there an easy way for me to find out this information > on > my own? Perhaps if someone could point out which file something like this was > defined in, I could look at the latest version of the file to see if the > change > is in there? > > If it affects the answers, I'm using Windows XP x64 version, and I will be > using > Ozkan's build from mingw-w64-bin_x86_64-mingw_20100123_sezero.zip > > I'd like to use the #define __USE_MINGW_ANSI_STDIO 1 in the code. Can I wrap > this define inside of a check like: > #ifdef __MINGW64__ > #define __USE_MINGW_ANSI_STDIO 1 > #endif > > Is that the correct ifdef I should be using, or is there a different define I > should be looking for? > > -David C. > Hi, 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. -- 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
