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

发布于 2022-09-04 00:55:12 字数 6617 浏览 17 评论 0

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
图片描述

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笑着哭最痛 2022-09-11 00:55:13

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

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

clipboard.png

掌心的温暖 2022-09-11 00:55:13

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文