什么是-m32,-m64和gcc的选项之间没有什么区别?

时间:2016-11-15 14:22:34

标签: gcc compiler-options

gcc -m32 main.cpp

gcc -m64 main.cpp

gcc main.cpp

gcc选项中-m32-m64nothing之间的区别是什么?

1 个答案:

答案 0 :(得分:5)

请参阅gcc手册页[here],它表示

-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.