Compiling 32-bit code on a 64-bit machine

This tip submitted by vinay Kumar on 2010-09-06 11:23:15. It has been viewed 10380 times.
Rating of 6.6 with 41 votes

If code is written to support only 32-bit architectures, but you're compiling with gcc/g++ on a 64-bit machine, always add the following flag in your makefile and then compile.

CFLAGS = -m32

without this if you compile the code, it will give you a 64-bit executable, which of course will not run on a 32-bit machine.

More tips

Help your fellow programmers! Add a tip!