gpt4 book ai didi

c - 安装了 MinCW 和 cygwin 但无法编译任何东西

转载 作者:行者123 更新时间:2023-11-30 17:33:18 29 4
gpt4 key购买 nike

每次我尝试编译一个简单的 hello world 程序时,我都会收到一个充满错误的控制台。我有 DevC++,当我使用 IDE 时,它编译得很好并且工作得很好,但我开始从 Notepad++ 和命令行执行所有操作。这是我的错误:

C:\Users\root\Desktop>g++ helloworld.c -o helloworld.exe
In file included from c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/
4.4.3/../../../../include/stdio.h:26,
from helloworld.c:1:
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686
-w64-mingw32/include/stddef.h:20: error: expected constructor, destruc
tor, or type conversion before '_set_errno'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686
-w64-mingw32/include/stddef.h:21: error: expected constructor, destruc
tor, or type conversion before '_get_errno'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686
-w64-mingw32/include/stddef.h:26: error: expected initializer before '
__threadhandle'
In file included from helloworld.c:1:
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:191: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:202: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:206: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:209: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:210: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:289: error: expected constructor, destructor, or type conv
ersion before 'fread'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:290: error: expected constructor, destructor, or type conv
ersion before 'fwrite'
In file included from helloworld.c:1:
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:438: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:442: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:446: error: expected constructor, destructor, or type conv
ersion before 'fgetwc'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:447: error: expected constructor, destructor, or type conv
ersion before 'fputwc'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:448: error: expected constructor, destructor, or type conv
ersion before 'ungetwc'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:453: error: expected constructor, destructor, or type conv
ersion before 'getwc'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:454: error: expected constructor, destructor, or type conv
ersion before 'getwchar'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:456: error: expected constructor, destructor, or type conv
ersion before 'putwc'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:458: error: expected constructor, destructor, or type conv
ersion before 'putwchar'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:472: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:474: error: 'size_t' has not been declared
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:496: error: expected constructor, destructor, or type conv
ersion before '_fgetwchar'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:497: error: expected constructor, destructor, or type conv
ersion before '_fputwchar'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:502: error: expected constructor, destructor, or type conv
ersion before 'fgetwchar'
c:\strawberry\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../incl
ude/stdio.h:503: error: expected constructor, destructor, or type conv
ersion before 'fputwchar'

最佳答案

看起来好像您使用了错误的库(可能文件已损坏或不存在于编译器搜索的位置)。或者也许您还没有添加所需的所有库。当我输入错误的库名称时,我也遇到了同样的问题。

关于c - 安装了 MinCW 和 cygwin 但无法编译任何东西,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23793204/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com