Setting up MingW and Code::Blocks in Windows 8 64 bit

為{幸葍}努か 提交于 2019-12-01 01:10:14

If you don't require 64 bit support, consider downloading "codeblocks-12.11mingw-setup.exe"
It packs its own 32 bit mingw and has everything preconfigured for you.

Otherwise, if you still need to compile amd64 apps:-
Assuming you extracted to D:\Mingw64, under the "Tool Chain Executables" tab, set the "Compiler's Installation Directory" to "D:\Mingw64\bin", Then click auto-detect to check whether code::blocks likes what it finds.

If everythings Ok, make sure the rest of the fields are as follows:-

C compiler: x86_64-w64-mingw32-gcc.exe
C++ compiler: x86_64-w64-mingw32-g++.exe
Linker for dynamic libs: x86_64-w64-mingw32-g++.exe
Linker for static libs: x86_64-w64-mingw32-ar.exe
Debugger: GDB/CDB Debugger... 
Ressource compiler: x86_64-w64-mingw32-windres.exe
Make program: mingw32-make.exe

Click on the "Additional Paths" tab and enter the following line:- (the path is correct for ver 4.7.4,the one you downloaded. It ends with 4.7.3)

D:\Mingw64\libexec\gcc\x86_64-w64-mingw32\4.7.3\ 

Click on the "Search directories" tab to the imediate left "Toolchain Executables"
Add the following paths:-

D:\Mingw64\include
D:\Mingw64\x86_64-w64-mingw32\include
D:\Mingw64\x86_64-w64-mingw32\include\c++\4.7.3
D:\Mingw64\x86_64-w64-mingw32\include\c++\4.7.3\backward
D:\Mingw64\x86_64-w64-mingw32\include\c++\4.7.3\x86_64-w64-mingw32
D:\Mingw64\lib\gcc\x86_64-w64-mingw32\4.7.3\include

Click on the "linker" tab and add the following paths:-

D:\Mingw64\Lib 
D:\Mingw64\x86_64-w64-mingw32\lib

And finally click on the "Compiler Settings tab", Click on "Other options" and add:-

-m64

One last thing-> remember to save those settings to disk!
If it crashes while you test this new config, you might wish you had!
Do this (I think) either by "File->Save Everything" or restarting code::blocks ...without another instance running.

Try compiling something then share the outcome

Peace! Dear brother, I think you need this:

(1) std::cout << "Hello world!" << std::endl;

You need to put "std::function_name" whenever you are using a predefined function from iostream.h, because this is you way access it in GCC, which Code::Blocks uses.

(2) Try it compiling by omitting "using namespace std;" from your code. Because I've compiled C and C++ code many times in Code::Blocks on 32-bit Windows XP, and it did!

(3) Make sure the path is set to the directory "mingw\bin".

(4) Ensure if you have 64-bit MinGW installed and path set to its "bin" directory (if you want to compile for 64-bit). It will compile for 64-bit by default.

(5) Try the flags/arguments "-m32" and "-m64" for compiling for 32- and 64-big respectively.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!