title: How can I compile a 32-bit .o file with gcc in my 64-bit machine?
body: <p>Trying to learn NASM Assembly. I have a 64-bit machine, with Ubuntu. Recently I decided to test the <code>push</code> and <code>pop</code> instructions. I do this:</p>
  
  <pre><code>nasm -felf64 Test.asm
  </code></pre>
  
  <p>Apparently they are not supported in 64-bit mode. Alright, no problem, I'll just do it for 32 then:</p>
  
  <pre><code>nasm -felf Test.asm
  </code></pre>
  
  <p>And now, as always,</p>
  
  <pre><code>gcc Test.o
  </code></pre>
  
  <p>But it now tells me</p>
  
  <pre><code>i386 architecture of input file 'Test.o' is incompatible with i386:x86-64 output
  </code></pre>
  
  <p>I don't quite grasp the error here. How can I test <code>push</code> and <code>pop</code> in my 64-bit machine, if apparently I can't compile 32-bit programs?</p>