在Windows 8 64位中设置MingW和Code :: Blocks [英] Setting up MingW and Code::Blocks in Windows 8 64 bit
问题描述
我在我的 Windows 8 64位元笔记本电脑上尝试设置 MingW 和 Code :: Blocks ,我遇到了一些问题同时构建一个 main.cpp
文件。这些是我安装的版本:
I am trying to setup MingW and Code::Blocks on my Windows 8 64 bit laptop, and I'm facing some problem while building a main.cpp
file. These are the versions that I have installed:
- x86_64-w64-mingw32-gcc-4.7.4-release-win64_rubenvb.7z for MingW (该列表中的第四个)和
- codeblocks-12.11-setup.exe 。
- x86_64-w64-mingw32-gcc-4.7.4-release-win64_rubenvb.7z for MingW (4th one in that list), and
- codeblocks-12.11-setup.exe for Code::Blocks.
在环境变量中设置了 mingw64\bin
的路径。此外,在Code :: Blocks编译器设置中,我已为所有 ToolChain可执行文件设置路径。在 MingW bin路径中有两个 gcc 。一个是 - gcc.exe
,其他是 - x86_64-w64-mingw32-gcc.exe
。与 C ++编译器,静态和动态库的链接器相同。现在,当我尝试构建一个简单的 Hello World 文件时,它显示一些错误:
I've set the path to mingw64\bin
in the environment variable. Also, in the Code::Blocks compiler settings, I have set path for all ToolChain Executables. There are two gcc in the MingW bin path. One is - gcc.exe
and other is - x86_64-w64-mingw32-gcc.exe
. Same for C++ Compiler, Linker for static and dynamic libs. Now when I try to build a simple Hello World file, it shows some errors:
obj\Debug\main.o -- In function swscanf
c:\mingw\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\4.7.3\..\..\..\..\x86_64-w64-mingw32\include\wchar.h -- undefined reference to `__gxx_personality_sj0'
obj\Debug\main.o -- In function `wscanf':
c:\mingw\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\4.7.3\..\..\..\..\x86_64-w64-mingw32\include\wchar.h -- undefined reference to `__gxx_personality_sj0'
同样,有许多错误和未定义的引用 - fwprintf
code> wprintf , std:cout
等。
Similarly there are many errors and undefined references for - fwprintf
, wprintf
, std:cout
, etc..
'确定有一些配置问题,但我找不到什么问题。
I'm sure there is some configuration problem, but I cannot find out what's the issue. Can any one take a look at the problem.
以下是我正在运行的代码:
Here's the code I'm running:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
推荐答案
64位支持,请考虑下载codeblocks-12.11mingw-setup.exe
它包装其自己的32位mingw,并为您预配置所有内容。
否则,如果你仍然需要编译amd64应用程序: -
假设你解压到D:\Mingw64,在工具链可执行文件选项卡下,将编译器的安装目录设置为D:\ Mingw64 \bin,然后点击自动检测来检查代码:: blocks是否喜欢它找到的内容。
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.
如果everythings确定,的字段如下: -
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
点击附加路径选项卡并输入以下行: - (下载的版本4.7.4版本的路径正确。结束于4.7.3)
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\
点击搜索目录选项卡到左侧Toolchain Executables
添加以下路径: -
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.
这篇关于在Windows 8 64位中设置MingW和Code :: Blocks的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!