views:

28

answers:

1

I'm currently writing a little program in c++ on my 64bit Ubuntu Pc. By default eclipse compiles the program for a 64bit architecture. Since I want to use my little program on my server which is still 32bit, I need to be able to compile my program for 32bit. How could can I do that in eclipse? I've been fiddling for a while with the settings but nothing worked...

Cheers

+1  A: 

I found the answer myself, after lots of searching and trying things out. This is a solution that works if you happen to have the same problem. For this to work the following packages have to be installed:

  • gcc/g++ with multilib

  • ia32-libs

Then right click on your project, and select "properties". Go to "C/C++ Build" and choose "settings". Under "GCC/G++ Compiler" add "-m32" to the command field (the field should now say "g++ -m32"). Do the same for "GCC/G++ Linker".

Now that you have added the flag, this should be compiled for 32bit. I'm using Eclipse Galileo, for the case that your interface looks different. I only added the "-m32" flag only under the "Release" profile, so my "Debug" builds are still 64bit.

Basil