2016-11-15 6 views
1
gcc -m32 main.cpp 

gcc -m64 main.cpp 

gcc main.cpp 

В чем разница между -m32, -m64 и nothing в вариантах gcc?В чем разница между -m32, -m64 и ничего в настройках gcc?

+0

Вы можете запустить 'человек gcc', чтобы найти ответ, или [читать здесь] (https://gcc.gnu.org/onlinedocs /gcc/x86-Options.html). Используемый флаг по умолчанию определяется тем, как был сконфигурирован компилятор при построении, обычно подразумевая * -m64 * для 64-разрядных сред. –

ответ

3

Обратитесь к Gcc Manual Page [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.