Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
403 Views

How to compile a code for 32-bit machine on a 64-bit machine?

Hi,

I'm using prallel studio, which includes the intel C++ compiler itself. I'm a windows user, and my system is 64-bit. I want to compile a code on my computer for a 32-bit computer. I mean that I want to run the binary, on a 32-bit system.

Would you please help me that what compiler options I should use? ( I compile my source codes from command line in windows. )

Thanks.

0 Kudos
5 Replies
Highlighted
Valued Contributor II
403 Views

>>...I'm using prallel studio, which includes the intel C++ compiler itself... . Do you have a 32-bit or 64-bit version? For 32-bit binaries you need to use a 32-bit Intel C++ compiler.
0 Kudos
Highlighted
Beginner
403 Views

Oh! you mean it depends on the version of the compiler? I thought there should be a compiler option which can choose between 32/64 bit systems. So you mean to compile the code for 32 bit machine I must have intel 32 bit version compiler? thanks.
0 Kudos
Highlighted
Black Belt
403 Views

Yes, you need the 32-bit compiler to build a 32-bit application. If you are on linux or mac, you must install a working 32-bit g++ before installing icc for ia32. On a 64-bit linux or mac OS you could install 64-bit g++ alone or together with the 32-bit one. If the -m32 option works, it simply switches you over to the 32-bit tools, if they are installed. For Windows Visual Studio 2010 or 2012, the 32- and 64-bit Microsoft compilers are installed together, but in separate folders.
0 Kudos
Highlighted
Valued Contributor II
403 Views

>>...I thought there should be a compiler option which can choose between 32/64 bit systems. . Unfortunately there is no an option to do this. Microsoft also uses different C++ compilers for different platforms.
0 Kudos
Highlighted
Employee
403 Views

To invoke the 32-bit compiler on Windows you can either open a 32-bit command prompt from the Parallel Studio XE or C++ Composer XE program group under "Command Prompt-->Parallel Studio XE with Intel Compiler XE v13.0-->IA-32 Visual Studio 2010 mode" or the one for VS2012 or VS2008. Invoking icl.exe in that command window will use the 32-bit compiler and libraries. You can also set up your own build environment for 32/64 by using the compilervars.bat as shown below: c:\Program Files (x86)\Intel\Composer XE 2013\bin>compilervars Syntax: compilervars.bat [vs] must be is one of the following ia32 : Set up for IA-32 host and target ia32_intel64 : Set up for IA-32 host and Intel(R)64 target intel64 : Set up for Intel(R) 64 host and target If specified, must be one of the following vs2008 : Set to use Microsoft Visual Studio 2008 vs2008shell : Set to use Microsoft Visual Studio Shell 2008 vs2010 : Set to use Microsoft Visual Studio 2010 vs2010shell : Set to use Microsoft Visual Studio Shell 2010 vs2012 : Set to use Microsoft Visual Studio 2012 vs2012shell : Set to use Microsoft Visual Studio Shell 2012 If is not specified, the version of Visual Studio detected at install time is used.
0 Kudos