无法在Clion中安装MinGW

5

最近我安装了Clion,但是连“Hello World”应用程序都无法编译。我单独安装了MinGW编译器,但是当我尝试编译“Hello World”应用程序时,出现了以下错误:

In file included from c:\mingw\include\wchar.h:45:0,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\cwchar:44,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\postypes.h:40,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\iosfwd:40,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\ios:38,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\iostream:39,
                 from C:\Users\Alexandr\ClionProjects\untitled2\main.cpp:1:
c:\mingw\include\wctype.h:67:1: error: '_CRTIMP' does not name a type
 _CRTIMP int __cdecl __MINGW_NOTHROW iswalnum(wint_t);
 ^
...........
 ^
c:\mingw\include\wctype.h:76:1: error: '_CRTIMP' does not name a type
 _CRTIMP int __cdecl __MINGW_NOTHROW iswprint(wint_t);
 ^
c:\mingw\include\wctype.h:77:1: error: '_CRTIMP' does not name a type
 _CRTIMP int __cdecl __MINGW_NOTHROW iswpunct(wint_t);
 ^
c:\mingw\include\wctype.h:80:1: error: '_CRTIMP' does not name a type
 _CRTIMP int __cdecl __MINGW_NOTHROW iswxdigit(wint_t);
 ^
c:\mingw\include\wctype.h:84:29: error: expected initializer before 'iswblank'
 int __cdecl __MINGW_NOTHROW iswblank (wint_t);
                             ^
c:\mingw\include\wctype.h:90:1: error: '_CRTIMP' does not name a type
 _CRTIMP wint_t __cdecl __MINGW_NOTHROW towlower (wint_t);
 ^
c:\mingw\include\wctype.h:91:1: error: '_CRTIMP' does not name a type
 _CRTIMP wint_t __cdecl __MINGW_NOTHROW towupper (wint_t);
 ^
c:\mingw\include\wctype.h:93:1: error: '_CRTIMP' does not name a type
 _CRTIMP int __cdecl __MINGW_NOTHROW isleadbyte (int);
 ^
c:\mingw\include\wctype.h:157:33: error: expected initializer before 'towctrans'
 wint_t __cdecl __MINGW_NOTHROW  towctrans(wint_t, wctrans_t);
                                 ^
c:\mingw\include\wctype.h:158:35: error: expected initializer before 'wctrans'
 wctrans_t __cdecl __MINGW_NOTHROW wctrans(const char*);
                                   ^
c:\mingw\include\wctype.h:159:34: error: expected initializer before 'wctype'
 wctype_t __cdecl __MINGW_NOTHROW wctype(const char*);

我该如何修复它?
1个回答

6

我刚刚正确安装了一份全新的 MingW,并选择了许多需要安装的包,在此之后,您需要安装 CLion 1.1.1,并将路径设置为 C:\MingW\bin,添加到环境变量 PATH 中。

MingW 的安装链接:http://sourceforge.net/projects/mingw/files/

我创建了一个 hello 项目并编译它,一切都很正常。

这里是 hello world 的执行结果,没有编译问题。

如果出现路径问题,就像我遇到的那样,您需要重新安装 CLion,并像我一样将路径视为已识别的路径。

enter image description here

在 Windows 7 下测试通过。


1
他们有一个安装程序,可以从SourceForge下载所选的MinGW软件包。 - MaXiMkA
这个问题标记了mingw-w64,你确定它可以创建一个64位的可执行文件吗? - AndreKR
1
对我来说,mingw32-basemingw32-gcc-g++ 就足够让它工作了。 - Kirill

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接