From: Ozkan S. <se...@gm...> - 2010-02-01 07:28:26
|
On Mon, Feb 1, 2010 at 4:59 AM, David Cleaver <wr...@mo...> 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 <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? > 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 |