codeblocks编译c可以,编译c++一堆错误
高洛峰
高洛峰 2016-11-01 11:05:53
0
1
1304

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)) ===|

编译器配置如下

1.png

1.png

已检查环境变量,配置如下

1.png

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

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

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

查阅过的资料地址:

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

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

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

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

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

工程的 properties下的build target

1.png

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
三叔

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

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

1.png

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template