News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Using -m32 Flag throws error in compilation

Started by 0xbrokenmind, December 08, 2021, 09:02:24 PM

Previous topic - Next topic

0xbrokenmind

Hi,
I am using codeblocks-20.03mingw. With default setting, the program is compiled for 64-bit systems. I want to compile the program to 32-bit system. I enabled -m32 flag in Setting->Compiler->Global compiler settings->GNU GCC compiler->Compiler settings. When i build the program, it throws following error. Pls see the attached image. How to build my program only for 32-bit system. Not for 64-bit system

stahta01

Step 1: Install an 32 bit MinGW Compiler
Step 2: Configure Code::Blocks IDE to use it.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

0xbrokenmind

Thanks.

I tried as you told. It works. Now I can compile a program for 32-bit system {using 32-bit mingw} & 64-bit system {using default codeblocks' mingw}.

Is there any work-around to compile for 32-bit system by using default codeblocks' mingw?

AndrewCot

Download the C::B package that has the 32bit Mingw compiler bundled with it, codeblocks-20.03mingw-32bit-setup.exe.... But then you will build 32 bit exes and you would need to install the 64 bit Mingw.

It may be easier to effectively start again and grab C::B without a compiler and then install both the 32 and 64 bit MinGW compilers separately. You then swap the compiler directory via the compiler settings to point to with the 32 or 64 bit compilers.