-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04.10.2013 18:15, Incongruous wrote:
> Which of these compilers should I use if I want to compile in 64bit?
> 
> <prefix>/bin/g++.exe
> <prefix>/bin/x86_64-w64-mingw32-g++.exe
> 
> 
> Is this correct?
> 
> if(OS_64_BIT){
>    <prefix>/bin/g++.exe
> }
> else{
>    <prefix>/bin/x86_64-w64-mingw32-g++.exe
> }

No.

1) gcc compiles for its target triplet.
2) target triplet is put into prefix (i.e. x86_64-w64-mingw32 is the
prefix for g++)
3) target triplet can be found by invoking `gcc -dumpmachine'
4) if gcc has no prefix (i.e. just g++.exe), then -dumpmachine is the
only way to find the target (well, not really, but this is what you
should use).
5) on sane systems (MSYS2-based sbuild, most GNU systems) `gcc', `g++'
and other un-prefixed executables are, in fact, symbolic links to real,
prefixed executables

Another point that you should keep in mind is where gcc looks for libs
and headers.
Run `echo | [<gcc executable>] -E -v -' to see where it looks for headers.
Run `[<gcc executable>] -print-search-dirs' to see where it looks for
libs (replace [<gcc executable>] with the executable name).

So, your assessment makes no sense. g++ could be the right thing to use.
Or maybe it isn't. You will never know until you check its target.
x86_64-w64-mingw32-g++ is not the right thing to use for non-64-bit
OSes, because it compiles for 64-bit OSes (that is obvious from its
prefix). Most likely (let's keep it real - usually people don't mix
unprefixed i686-gcc with prefixed x86_64-gcc) both executables will
produce x86_64 code.

If you do want to actually compile for i686 and x86_64, you need either
a multilib toolchain (these are rare; if you do find one, use -m32 and
- -m64 to set its target) or two separate toolchains.

If toolchains are native, you can't mix them in the same directory, as
they look in the same directories for libs and headers, and their libs
are different (but have the same names).
If toolchains are not native (are cross-compilers; self-targetted or not
- - that does not matter) you may be able to mix them in the same
directory, as they look for stuff in <tirplet> subdirectories. Note that
i have never tried to do that, and generally don't use cross-compilers.

Finally, if you use autotools, then you don't have to select which
compiler to use, as configure script will do that for you. You only need
to specify the right --build or --host

- -- 
O< ascii ribbon - stop html email! - www.asciiribbon.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)

iQEcBAEBAgAGBQJSTttTAAoJEOs4Jb6SI2CwBAcH/RvAkQe8RsimfdZXpdxDHnpx
YUv6ptc1GOasyT4g1AxH8NUUX5QAstPkBEIB5gaG82p1rjGzYeBqXcMD9tHPYVdE
hqHxpL686Mxv24cyt7O7T0dJt2+sYpmH7CJnGXy6BN20NeWQO89lmvTH/YPaLNsE
fKpjfVyfk2lTUuPVXdZTt5A5WRc3l45pXsyswIQrxp6NusdTGcwkCdqU7bvMpPRa
WDEt54UcSgLXDxlGo3atjg6DAFfUZneloUznD5Taqokc4fv6TeKheOmKuSU9LAOX
VIoiDKTjuBXc69J4pu9UQmhWhWN14lwzo/UxYeSP/qdQE9xjyy8lP+rOsM7AyQw=
=CD7U
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to