Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building 64 bit exe using mingw gcc in codeblocks

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))
like image 510
MistyD Avatar asked Dec 06 '25 12:12

MistyD


1 Answers

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.

like image 85
Dmitry Sokolov Avatar answered Dec 09 '25 20:12

Dmitry Sokolov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!