gcc选项中的-m32、-m64和无选项有什么区别?

10
gcc -m32 main.cpp

gcc -m64 main.cpp

gcc main.cpp

-m32-m64nothing在gcc选项中有什么区别?


1
你可以运行 man gcc 来查找答案,或者在这里阅读。默认使用的标志由编译器构建时的配置方式确定,通常意味着在64位环境下使用 -m64 标志。 - Margaret Bloom
1个回答

18

请参考gcc手册页面[这里],它指出

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

我假设“nothing”意味着默认使用本地系统的架构。 - NateW

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接