3

I am trying to build a 64 bit exe using minGW 64 bit. Which can be obtained from here (Since the project is moving from sourceforge.net to mingw-w64.org I suggest to use mingw-w64.org). Now my machine is a 64 bit machine and when I build my code through the compiler I get back a 32 bit exe. This is the output of the program

-------------- Build: Debug in TestCodeBlocks (compiler: MinGW GCC - 2/17/2015)---------------

i686-w64-mingw32-g++.exe -Wall -std=c++98 -g  -c C:\Users\admin\TestCodeBlocks\main.cpp -o obj\Debug\main.o
i686-w64-mingw32-g++.exe  -o bin\Debug\TestCodeBlocks.exe obj\Debug\main.o   
Output file is bin\Debug\TestCodeBlocks.exe with size 58.17 KB

Any suggestions on why I might be getting back a 32 bit exe ?

This is what my toolchain in codeblocks looks like

enter image description here

Update:

I downloaded the 64 bit Mingw gcc compiler and this is what my settigns look like

enter image description here

However when I attempt to run my program I get

x86_64-w64-mingw32-g++.exe -Wall -std=c++98 -g -m32  -c C:\Users\admin\TestCodeBlocks\main.cpp -o obj\Debug\main.o
ar  -o bin\Debug\TestCodeBlocks.exe obj\Debug\main.o   
ar: no operation specified
Process terminated with status 1 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
LiamB
  • 18,243
  • 19
  • 75
  • 116
MistyD
  • 16,373
  • 40
  • 138
  • 240

1 Answers1

3

The 64bit g++ has name x86_64-w64-mingw32-g++.exe.

Make sure you are using the right toolchain.

Make sure the right g++ is on PATH and is not hidden by another version of g++.

UPDATE

Use 64bit MinGW version.

Also, see Mingw-w64 Downloads.

Dmitry Sokolov
  • 3,118
  • 1
  • 30
  • 35
  • 1
    `i686-` prefix means that you are using 32bit MinGW. – Dmitry Sokolov Feb 17 '15 at 19:55
  • So after downgrading the new mingw gcc . When I attempt to build it I get the message "sorry - this program has been built without plugin support" – MistyD Feb 19 '15 at 18:59
  • Use `.exe` files without prefix, i.e. `g++.exe`, `ar.exe`, as described [here](http://stackoverflow.com/questions/23796017/building-static-library-using-codeblock-with-mingw). – Dmitry Sokolov Feb 19 '15 at 19:30
  • 1) `g++ -m32` will build 32bit binaries, check your project profile settings. 2) Change 'Linker for dynamic libs' to `g++` – Dmitry Sokolov Feb 19 '15 at 21:03
  • @DmitrySokolov mingw-w64 isn't dual-target any more (i.e. you can't just use `-m32` to switch), [according to here](http://stackoverflow.com/questions/16304804/dual-target-mingw-w64-isnt-really-dual-target) – M.M Feb 19 '15 at 21:32
  • @Matt McNabb It only concerns to the 64bit "SEH" MinGW version that can not build 32bit binaries with SEH exception handling, but there is also "SJLJ" version which can. – Dmitry Sokolov Feb 20 '15 at 05:47