User forums > Using Code::Blocks

32 and 64 builds with mingw on Windows (NEWBIE question)

(1/2) > >>

nji:
I recently installed 64bit build of v.20.03, bundled with mingw (on Window7 64bit).

Building a simple console app it builds it to 64bit without problems.

When I have a look at the project's build options
Compiler Settings/ Compiler Flags / General
there are Targets 32 and 64 bit, both deselected.

But in the command line there is -m64. Why?

If I choose 32bit target in the compiler settings (-m32)
both -m32 and -m64 are used for the command line.
What is the effect by that?

Also the linker gives lots of errors then like

--- Code: ---...ld.exe: cannot find -lstdc++
--- End code ---

What do I have to do additionally to build 32bit apps?

Simple questions, but maybe may be answered in short
and of help not only for me but for other new users.

BlueHazzard:
If you have compiling problems, post a full rebuild log as described here:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

There are essentially 3 places where compiler options are set:
1) Global compiler settings: Settings->Compiler -> Select your compiler from the drop down at the top->Compiler settings
2) Project level: Project->Build options->Select the project name on the left->Compiler
3) Target level: Project->Build options->Select the target name on the left->Compiler

All this options stack together...

nji:
Better I'll try again:

I do the most sophisticated task of building a console app.
(All settings are as of installed C:B/ mingw).

Let it build ...

"Hello world!"

Then change the project's/ target's build options to -m32.
Do a rebuild ... and get the linker errors above.
What is missing?

sodev:
Mingw-w64 toolchains are not multilib, they can compile only for one architecture. To build for 32 bit you have to download a 32 bit toolchain and either update the GCC compiler configuration of CodeBlocks to use that one instead, or, if you want to build for both architectures, add a new compiler configuration and use that one in the project.

nji:
Thank you.

So I misunderstood the 2nd note of
http://www.codeblocks.org/downloads/26
I thought 32/64 bit would mean the target.

(Still I wonder why the compiler allows to produce 32bit code, just the linker fails (see posts above)).

Navigation

[0] Message Index

[#] Next page

Go to full version