gcc -m32 main.cpp
gcc -m64 main.cpp
gcc main.cpp
What's the differences between -m32
, -m64
, and nothing
in gcc's options?
DIFFERENCE BETWEEN g++ & gccg++ is used to compile C++ program. gcc is used to compile C program.
fPIC option in GCC enables the address of shared libraries to be relative so that the executable is independent of the position of libraries. This enables one to share built library which has dependencies on other shared libraries. fPIC stands for "force Position Independent Code".
g++ command is a GNU c++ compiler invocation command, which is used for preprocessing, compilation, assembly and linking of source code to generate an executable file.
-no-pie. Don't produce a dynamically linked position independent executable. -static-pie. Produce a static position independent executable on targets that support it. A static position independent executable is similar to a static executable, but can be loaded at any address without a dynamic linker.
Refer to gcc Manual Page [here], it indicates
-m32 -m64 Generate code for a 32-bit or 64-bit environment.
The 32-bit environment sets int, long and pointer to 32 bits and
generates code that runs on any i386 system.
The 64-bit environment sets int to 32 bits and long and pointer to
64 bits and generates code for AMD 's x86-64 architecture.
For darwin only the -m64 option turns off the -fno-pic and -mdynamic-no-pic options.
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