Window7 + MinGW 下配置Clion

1、下载Clion点击打开链接;

2、下载MingGW点击打开链接;

3、下载好MingGW,安装MinGW Installer,选择如下组件,全部安装即可;

Window7 + MinGW 下配置Clion_第1张图片

4、配置环境变量,参考点击打开链接;

5、安装clion,选择使用注册码(应该还能使用)进行安装;

6、配置MingGw,选择File->Settings->Build,Execution,Deloyment->Toolchains,选择MinGW安装路径,然后选择OK;

Window7 + MinGW 下配置Clion_第2张图片

7、新建HelloWorld项目,点击Build,出现如下错误:

In file included from c:\mingw\include\wchar.h:208:0,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:44,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iosfwd:40,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ostream:38,
                 from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iostream:39,
                 from E:\Android\clion\Helloworld\main.cpp:1:
c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );
              ^
c:\mingw\include\sys/stat.h:173:14: error: '_ino_t' does not name a type
 struct _stat __struct_stat_defined( _off_t, time_t );

解决办法:修改set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")为set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11"),点击Reload changed即可,运行成功。

Window7 + MinGW 下配置Clion_第3张图片

你可能感兴趣的:(Clion)