10
gcc -m32 main.cpp

gcc -m64 main.cpp

gcc main.cpp

What's the differences between -m32, -m64, and nothing in gcc's options?

xmllmx
  • 39,765
  • 26
  • 162
  • 323
  • You can run `man gcc` to find the answer, or [read here](https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html). The default flag used is determined by how the compiler was configured when built, usually implying *-m64* for 64-bit environments. – Margaret Bloom Nov 15 '16 at 14:34

1 Answers1

18

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. 
Sean83
  • 493
  • 4
  • 14
  • And I'm assuming that nothing means it just defaults to whatever the local system's architecture is? – NateW Jul 20 '23 at 23:23