codeblocks编译c可以,编译c++一堆错误

codeblocks 版本号16.01

mingw版本号 0.6.2-beta-20131004-1

一个简单地c++程序

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

出现了如下错误


||=== Build: Debug in helloworld (compiler: GNU GCC Compiler) ===|
d:codeblockmingwmingwincludesysstat.h|173|error: '_dev_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|173|error: '_ino_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|173|error: '_mode_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|173|error: '_dev_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|173|error: '_off_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|173|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|173|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|173|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|180|error: '_dev_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|180|error: '_ino_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|180|error: '_mode_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|180|error: '_dev_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|180|error: '_off_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|180|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|180|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|180|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|188|error: '_dev_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|188|error: '_ino_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|188|error: '_mode_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|188|error: '_dev_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|188|error: '__off64_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|188|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|188|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|188|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|195|error: '_dev_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|195|error: '_ino_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|195|error: '_mode_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|195|error: '_dev_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|195|error: '__off64_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|195|error: '__time64_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|195|error: '__time64_t' does not name a type|
d:codeblockmingwmingwincludesysstat.h|195|error: '__time64_t' does not name a type|
d:codeblockmingwmingwincludeio.h|335|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludeio.h|335|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludeio.h|335|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludeio.h|336|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludeio.h|336|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludeio.h|336|error: 'time_t' does not name a type|
d:codeblockmingwmingwincludeio.h|362|error: '__time64_t' does not name a type|
d:codeblockmingwmingwincludeio.h|362|error: '__time64_t' does not name a type|
d:codeblockmingwmingwincludeio.h|362|error: '__time64_t' does not name a type|
d:codeblockmingwmingwlibgccmingw324.9.3includec++cwchar|146|error: '::fwide' has not been declared|
d:codeblockmingwmingwlibgccmingw324.9.3includec++cwchar|153|error: '::mbsinit' has not been declared|
d:codeblockmingwmingwlibgccmingw324.9.3includec++cwchar|164|error: '::vfwscanf' has not been declared|
d:codeblockmingwmingwlibgccmingw324.9.3includec++cwchar|170|error: '::vswscanf' has not been declared|
d:codeblockmingwmingwlibgccmingw324.9.3includec++cwchar|174|error: '::vwscanf' has not been declared|
d:codeblockmingwmingwlibgccmingw324.9.3includec++cwchar|191|error: '::wcstof' has not been declared|
d:codeblockmingwmingwlibgccmingw324.9.3includec++cwchar|198|error: '::wmemcmp' has not been declared|
d:codeblockmingwmingwlibgccmingw324.9.3includec++cwchar|199|error: '::wmemcpy' has not been declared|
d:codeblockmingwmingwlibgccmingw324.9.3includec++cwchar|200|error: '::wmemmove' has not been declared|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|


编译器配置如下
one

图片描述

已检查环境变量,配置如下
图片描述

本来一直在写c,编译正常。
昨天导师让熟悉c++,写了一个hello world的程序发现无法正常编译,build的时候已经出了问题,怀疑是编译器配置有问题,但我reset default 后,重新按照教程配置依然不可以。
有资料说

把-std=c++11修改为-std=gun++11

但我不理解,也不知道要怎么改啊。

查阅过的资料地址:

  1. http://stackoverflow.com/ques...

  2. http://bbs.csdn.net/topics/39...

  3. http://blog.csdn.net/ksksjipe...

  4. http://stackoverflow.com/ques...

跪求各位大神帮助,要哭了/(ㄒoㄒ)/~~

工程的 properties下的build target
图片描述

阅读 7.9k
2 个回答

我是安装好就可以用的,又一次想用codeblocks做了下winsock编程,改了下编译器,后来就和你一样了。
和你一样找了很多方法,都没用。

在我把之前勾选的选项,全取消,之后就没有任何问题了:

clipboard.png

你的Global Compiler settings中的C++ compiler改成mingw32-g++.exe
gcc编译cpp虽然在linux下好使~~在windows下可不一定。。:)
还有在我的机器上Linker for dynamic libs的也是mingw32-g++.exe

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题