Possible Duplicate:
Detecting 64bit compile in C
I want my program to run on both 32 bit and 64 bit Linux OS. So In my C code, I want the compiler to know when it is compiling for a 32 bit and 64 bit architecture. So, I need something like that
#ifdef X64
...
#else
...
#endif
Is there any such define in gcc?
I know of these:
__i386__
__x86_64__
I don't know how reliable they are.
The best option would be adding -DMY_32BIT
to the Makefile's compile line when compiling for 32 bits and checking for MY_32BIT
on your code. That way you can be sure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With