User forums > Using Code::Blocks

Using -m32 Flag throws error in compilation


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

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

Tim S.


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?

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.


[0] Message Index

Go to full version